package com.example.choupaiapp.main.fragment.mine;

import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.Rect;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.widget.AbsListView;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.Request;
import com.bumptech.glide.request.animation.GlideAnimation;
import com.bumptech.glide.request.target.SimpleTarget;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.dueeeke.videocontroller.StandardVideoController;
import com.dueeeke.videoplayer.player.VideoView;
import com.dueeeke.videoplayer.player.VideoViewManager;
import com.dueeeke.videoplayer.util.PlayerUtils;
import com.example.choupaiapp.R;
import com.example.choupaiapp.common.adapter.BaseAdapterHelper;
import com.example.choupaiapp.common.adapter.QuickAdapter;
import com.example.choupaiapp.common.constant.Contacts;
import com.example.choupaiapp.common.finalokgo.callback.Callback;
import com.example.choupaiapp.common.finalokgo.request.RequestType;
import com.example.choupaiapp.common.ui.fragment.CommonFragment;
import com.example.choupaiapp.common.util.ContextUtil;
import com.example.choupaiapp.common.util.DialogUtil;
import com.example.choupaiapp.common.util.GsonUtil;
import com.example.choupaiapp.common.util.SharedPreferencesHelp;
import com.example.choupaiapp.common.util.Utils;
import com.example.choupaiapp.common.view.XListView;
import com.example.choupaiapp.main.activity.home.OtherInfoActivity;
import com.example.choupaiapp.main.activity.home.VideoDetailActivity;
import com.example.choupaiapp.main.activity.mine.MineInvitationDetailActivity;
import com.example.choupaiapp.main.activity.mine.ReportActivity;
import com.example.choupaiapp.main.bean.ContentVoteListBean;
import com.example.choupaiapp.main.bean.MineAllListBean;
import com.example.choupaiapp.main.bean.RemindJson;
import com.example.choupaiapp.main.bean.SendCodeBean;
import com.example.choupaiapp.main.bean.ShareDataBean;
import com.example.choupaiapp.main.bean.UserInfoBean;
import com.example.choupaiapp.main.bean.VideoListBean;
import com.example.choupaiapp.main.callback.WechatCallBack;
import com.example.choupaiapp.main.constant.Config;
import com.example.choupaiapp.main.constant.Url;
import com.example.choupaiapp.main.util.WXShareUtil;
import com.example.choupaiapp.main.util.WechatLoginUtil;
import com.example.choupaiapp.main.util.video.PreloadManager;
import com.example.choupaiapp.main.util.video.VideoMineHashMap;
import com.example.choupaiapp.main.view.MyNineGridView;
import com.example.choupaiapp.main.view.MyNineGridViewAdapter;
import com.example.choupaiapp.main.view.video.ScaleFrameLayout;
import com.lzy.ninegrid.ImageInfo;
import com.lzy.okgo.model.HttpParams;
import com.lzy.okgo.model.Response;
import com.orhanobut.logger.Logger;
import com.scwang.smartrefresh.header.MaterialHeader;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
import com.shuyu.textutillib.RichTextView;
import com.shuyu.textutillib.listener.SpanAtUserCallBack;
import com.shuyu.textutillib.model.UserModel;
import com.sina.weibo.sdk.WbSdk;
import com.sina.weibo.sdk.api.TextObject;
import com.sina.weibo.sdk.api.WeiboMultiMessage;
import com.sina.weibo.sdk.auth.AuthInfo;
import com.sina.weibo.sdk.share.WbShareCallback;
import com.sina.weibo.sdk.share.WbShareHandler;
import com.tencent.connect.share.QQShare;
import com.tencent.connect.share.QzonePublish;
import com.tencent.mm.opensdk.modelbase.BaseResp;
import com.tencent.tauth.IUiListener;
import com.tencent.tauth.Tencent;
import com.tencent.tauth.UiError;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import org.json.JSONException;
import org.json.JSONObject;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
import de.hdodenhof.circleimageview.CircleImageView;

/**
 * Created by ASUS on 2019/10/30.
 */

public class MineAllFragment extends CommonFragment implements OnRefreshLoadMoreListener, WbShareCallback, WechatCallBack {

    @BindView(R.id.recycler_view)
    RecyclerView recyclerView;
    Unbinder unbinder;
    private int pageNum = 1;
    private int pageSize = 10;
    private BaseQuickAdapter<MineAllListBean.PageBean.ListBean, BaseViewHolder> quickAdapter;
    private PreloadManager mPreloadManager;
    private int currentPlayPosition = -1;
    @BindView(R.id.refreshLayout)
    SmartRefreshLayout refreshLayout;
    private UserInfoBean userInfoBean;
    private Tencent mTencent;
    private String isSelf;
    private int contentHidden;
    private int contentId;
    @BindView(R.id.empty_img)
    ImageView empty_img;

    SpanAtUserCallBack spanAtUserCallBack = new SpanAtUserCallBack() {
        @Override
        public void onClick(View view, UserModel userModel1) {
            Bundle bundle = new Bundle();
            bundle.putString("userId", userModel1.getUser_id());
            bundle.putString("userName", userModel1.getUser_name());
            startActivity(OtherInfoActivity.class, bundle);
            if (view instanceof TextView) {
                ((TextView) view).setHighlightColor(Color.TRANSPARENT);
            }
        }
    };

    public static MineAllFragment newInstance(UserInfoBean userInfoBean, String isSelf, int contentHidden) {
        MineAllFragment mineAllFragment = new MineAllFragment();
        mineAllFragment.userInfoBean = userInfoBean;
        mineAllFragment.isSelf = isSelf;
        mineAllFragment.contentHidden = contentHidden;
        return mineAllFragment;
    }

    /**
     * 将播放器从父控件中移除
     */
    private void removePlayerFormParent(VideoView mVideoView) {
        if (mVideoView != null) {
            ViewParent parent = mVideoView.getParent();
            if (parent instanceof FrameLayout) {
                ((FrameLayout) parent).removeView(mVideoView);
            }
        }
    }


    @Override
    public void onPause() {
        super.onPause();
        VideoViewManager.instance().pause();
    }


    @Override
    public void onResume() {
        super.onResume();
        if (currentPlayPosition != -1) {
            quickAdapter.notifyDataSetChanged();
            VideoMineHashMap.getIntance().get(currentPlayPosition).resume();
        }

    }

    private long formattingtime;
    private long TimeCha;

    private void timecha(String startime, TextView textView) {
        Calendar calendar = Calendar.getInstance();
        SimpleDateFormat dataformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        long currenttime = calendar.getTimeInMillis();//获取系统当先时间的毫秒值
        try {//如果你的初始时间是格式化过的,则需要先转化成毫秒值
            formattingtime = dataformat.parse(startime).getTime();
        } catch (ParseException e) {
            e.printStackTrace();
        }
//这里需要注意,因为获取的时间因为时差的缘故已经自动加上了8小时的时间,所以这里需要减去.如果不减去,就算是你刚刚发布的动态也会显示是8小时之前
        TimeCha = ((currenttime - formattingtime) / 1000) /*- (8 * 60 * 60)*/;//将毫秒值转化成分钟数
//        Logger.e(TimeCha+"");
        if (TimeCha < 60) {
            textView.setText("刚刚");
        } else if (TimeCha >= 60 && TimeCha < 3600) {
            textView.setText(TimeCha / 60 + "分钟前");
        } else if (TimeCha >= 3600 && TimeCha < 3600 * 24) {
            textView.setText(TimeCha / 3600 + "小时前");
        } else if (TimeCha >= 3600 * 1 * 24 && TimeCha < 3600 * 31 * 24) {
            textView.setText(TimeCha / 3600 / 24 + "天前");
        } else if (TimeCha >= 3600 * 31 * 24 * 1 && TimeCha < 3600 * 31 * 24 * 12) {
            textView.setText(TimeCha / 3600 / 24 / 30 + "个月前");
        } else {
            textView.setText(TimeCha / 3600 / 24 / 30 / 12 + "年前");
        }
    }


    @Override
    protected View initView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_all, container, false);

        unbinder = ButterKnife.bind(this, view);

        EventBus.getDefault().register(this);

        refreshLayout.setOnRefreshLoadMoreListener(this);
        refreshLayout.setEnableRefresh(false);
        refreshLayout.setRefreshHeader(new MaterialHeader(context).setColorSchemeResources(R.color.common_color));

        mPreloadManager = PreloadManager.getInstance(context);

        quickAdapter = new BaseQuickAdapter<MineAllListBean.PageBean.ListBean, BaseViewHolder>(R.layout.item_recomend) {
            @Override
            protected void convert(BaseViewHolder helper, MineAllListBean.PageBean.ListBean item) {
                LinearLayout container = helper.getView(R.id.container);
                item.setIsAttention(userInfoBean.getUser().getIsAttention());
                if (item.getType() == 1) {
                    Logger.e(item.getWidth() + "++++" + item.getHeight());
                    if (item.getHeight() >= item.getWidth()) {
                        /**
                         * 4：3视频
                         */
                        container.removeAllViews();
                        View childView = LayoutInflater.from(context).inflate(R.layout.item_recommend_video_4_3, null, false);
                        container.addView(childView);

                        /**
                         * 点赞和评论数
                         */
                        TextView praise_tv = childView.findViewById(R.id.praise_tv);
                        praise_tv.setText(item.getLikeSum() + "");

                        TextView comment_tv = childView.findViewById(R.id.comment_tv);
                        comment_tv.setText(item.getCommentSum() + "");

                        /**
                         *时间
                         */
                        TextView time = childView.findViewById(R.id.time);
                        timecha(item.getCreateTime(), time);

                        /**
                         * 评论按钮点击事件跳转详情页
                         */
                        ImageView comment = childView.findViewById(R.id.comment);
                        comment.setOnClickListener(view1 -> {
                            if (Utils.isDoubleClick()) {
                                return;
                            }
                            currentPlayPosition = item.getId();
                            Bundle bundle = new Bundle();
                            bundle.putString("flag", "video_4_3");
                            bundle.putSerializable("data", item);
                            bundle.putInt("position", helper.getAdapterPosition());
                            startActivity(MineInvitationDetailActivity.class, bundle);
                        });

                        /**
                         * 视频播放和点击事件
                         */
                        ScaleFrameLayout mcontainer = childView.findViewById(R.id.my_container);
                        VideoView myVideoView_4_3 = VideoMineHashMap.getIntance().get(item.getId());
                        mcontainer.removeAllViews();
                        removePlayerFormParent(myVideoView_4_3);
                        mcontainer.addView(myVideoView_4_3);

                        String playUrl = mPreloadManager.getPlayUrl(item.getUrls());
                        myVideoView_4_3.setUrl(playUrl);
                        StandardVideoController controller1 = new StandardVideoController(context);
                        myVideoView_4_3.setVideoController(controller1);
                        controller1.setPlayState(myVideoView_4_3.getCurrentPlayState());
                        controller1.setPlayerState(myVideoView_4_3.getCurrentPlayerState());
                        Glide.with(context)
                                .load(item.getUrls() + "?vframe/jpg/offset/1")
                                .crossFade()
                                .placeholder(android.R.color.darker_gray)
                                .into(controller1.getThumb());
                        myVideoView_4_3.setLooping(true);
                        myVideoView_4_3.setScreenScaleType(VideoView.SCREEN_SCALE_CENTER_CROP);
                        myVideoView_4_3.setMute(true);

                        controller1.getThumb().setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View view) {
                                //移除Controller
//                                if (item.getStatus() == 0) {
//                                    showImageToas("动态正在审核中");
//                                    return;
//                                }
                                if (Utils.isDoubleClick()) {
                                    return;
                                }
                                myVideoView_4_3.setVideoController(null);
                                currentPlayPosition = item.getId();
                                Bundle bundle = new Bundle();
                                VideoListBean videoListBean = new VideoListBean();
                                videoListBean.setVideoDownloadUrl(item.getUrls());
                                videoListBean.setCoverImgUrl(item.getUrls() + "?vframe/jpg/offset/1");
                                videoListBean.setTitle(item.getTitle());
                                videoListBean.setComment_num(item.getCommentSum());
                                videoListBean.setPraise_num(item.getLikeSum());
                                videoListBean.setHeadPhoto(item.getAvatar());
                                videoListBean.setNickName(item.getNickname());
                                videoListBean.setTime(item.getCreateTime());
                                videoListBean.setIsLike(item.getIsLike());
                                videoListBean.setAnonymity(item.getAnonymity());
                                videoListBean.setUserId(item.getUserId());
                                videoListBean.setContentId(item.getId());
                                List<RemindJson> remindJsons = GsonUtil.jsonToList(item.getRemindJson(), RemindJson.class);
                                videoListBean.setList(remindJsons);
                                bundle.putSerializable("data", videoListBean);
                                bundle.putInt("videoId", item.getId());
                                bundle.putString("categoriesId", item.getCategoriesId() + "");
                                bundle.putString("flag", "mineAll");
                                startActivity(VideoDetailActivity.class, bundle);
                            }
                        });

                        controller1.findViewById(R.id.start_play).setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View view) {
                                //移除Controller
                                if (Utils.isDoubleClick()) {
                                    return;
                                }
                                myVideoView_4_3.setVideoController(null);
                                currentPlayPosition = item.getId();
                                Bundle bundle = new Bundle();
                                VideoListBean videoListBean = new VideoListBean();
                                videoListBean.setVideoDownloadUrl(item.getUrls());
                                videoListBean.setCoverImgUrl(item.getUrls() + "?vframe/jpg/offset/1");
                                videoListBean.setTitle(item.getTitle());
                                videoListBean.setComment_num(item.getCommentSum());
                                videoListBean.setPraise_num(item.getLikeSum());
                                videoListBean.setHeadPhoto(item.getAvatar());
                                videoListBean.setNickName(item.getNickname());
                                videoListBean.setTime(item.getCreateTime());
                                videoListBean.setIsLike(item.getIsLike());
                                videoListBean.setAnonymity(item.getAnonymity());
                                videoListBean.setUserId(item.getUserId());
                                videoListBean.setContentId(item.getId());
                                List<RemindJson> remindJsons = GsonUtil.jsonToList(item.getRemindJson(), RemindJson.class);
                                videoListBean.setList(remindJsons);
                                bundle.putSerializable("data", videoListBean);
                                bundle.putInt("videoId", item.getId());
                                bundle.putString("categoriesId", item.getCategoriesId() + "");
                                bundle.putString("flag", "mineAll");
                                startActivity(VideoDetailActivity.class, bundle);
                            }
                        });

                        controller1.setOnClickListener(view12 -> {
                            //移除Controller
                            if (Utils.isDoubleClick()) {
                                return;
                            }
                            myVideoView_4_3.setVideoController(null);
                            currentPlayPosition = item.getId();
                            Bundle bundle = new Bundle();
                            VideoListBean videoListBean = new VideoListBean();
                            videoListBean.setVideoDownloadUrl(item.getUrls());
                            videoListBean.setCoverImgUrl(item.getUrls() + "?vframe/jpg/offset/1");
                            videoListBean.setTitle(item.getTitle());
                            videoListBean.setComment_num(item.getCommentSum());
                            videoListBean.setPraise_num(item.getLikeSum());
                            videoListBean.setHeadPhoto(item.getAvatar());
                            videoListBean.setNickName(item.getNickname());
                            videoListBean.setTime(item.getCreateTime());
                            videoListBean.setIsLike(item.getIsLike());
                            videoListBean.setAnonymity(item.getAnonymity());
                            videoListBean.setUserId(item.getUserId());
                            videoListBean.setContentId(item.getId());
                            List<RemindJson> remindJsons = GsonUtil.jsonToList(item.getRemindJson(), RemindJson.class);
                            videoListBean.setList(remindJsons);
                            bundle.putSerializable("data", videoListBean);
                            bundle.putInt("videoId", item.getId());
                            bundle.putString("categoriesId", item.getCategoriesId() + "");
                            bundle.putString("flag", "mineAll");
                            startActivity(VideoDetailActivity.class, bundle);
                        });

                        childView.findViewById(R.id.more).setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View view) {
                                if (Utils.isDoubleClick()) {
                                    return;
                                }
                                DialogUtil.getInstance().showCenterDialog(context, R.layout.dialog_more);
                                LinearLayout dialog_more = (LinearLayout) DialogUtil.getInstance().dialog_center_layout;
                                LinearLayout cancel_follow = dialog_more.findViewById(R.id.cancel_follow);
                                LinearLayout delete = dialog_more.findViewById(R.id.delete);
                                LinearLayout report = dialog_more.findViewById(R.id.report);
                                LinearLayout black_list = dialog_more.findViewById(R.id.black_list);

                                View line = dialog_more.findViewById(R.id.line);
                                View viewline = dialog_more.findViewById(R.id.view);
                                View view1 = dialog_more.findViewById(R.id.view1);

                                if ("1".equals(isSelf)) {
                                    report.setVisibility(View.GONE);
                                    black_list.setVisibility(View.GONE);
                                    cancel_follow.setVisibility(View.GONE);
                                    line.setVisibility(View.GONE);
                                    viewline.setVisibility(View.GONE);
                                    view1.setVisibility(View.INVISIBLE);
                                    delete.setVisibility(View.VISIBLE);
                                } else {
                                    cancel_follow.setVisibility(View.GONE);
                                    line.setVisibility(View.GONE);
                                    viewline.setVisibility(View.GONE);
                                    view1.setVisibility(View.INVISIBLE);
                                    report.setVisibility(View.VISIBLE);
                                    black_list.setVisibility(View.GONE);
                                    delete.setVisibility(View.GONE);
                                }

                                delete.setOnClickListener(new View.OnClickListener() {
                                    @Override
                                    public void onClick(View view) {
                                        if (Utils.isDoubleClick()) {
                                            return;
                                        }
                                        DialogUtil.getInstance().dialog_center.dismiss();
                                        showDialog(context, "删除中...");
                                        HttpParams params = new HttpParams();
                                        params.put("contentId", item.getId());
                                        finalOkGo.requestHead(RequestType.POSTHEAD, Url.DELETE_CONTENT, params, Url.DELETE_CONTENT, new Callback<SendCodeBean>() {
                                            @Override
                                            public void onSuccess(SendCodeBean sendCodeBean) {
                                                dismissDialog();
                                                if (sendCodeBean.getCode() == Contacts.SUCCESS) {
                                                    quickAdapter.remove(helper.getAdapterPosition());
                                                    quickAdapter.notifyDataSetChanged();
                                                } else {
                                                    if (sendCodeBean.getCode() == Contacts.TOKEN_EMPTY) {
                                                    } else {
                                                        showImageToas(sendCodeBean.getMsg());
                                                    }
                                                }
                                            }

                                            @Override
                                            public void onError(Response<String> response) {
                                                super.onError(response);
                                                dismissDialog();
                                            }
                                        });
                                    }
                                });

                                report.setOnClickListener(view19 -> {
                                    if (Utils.isDoubleClick()) {
                                        return;
                                    }
                                    DialogUtil.getInstance().dialog_center.dismiss();
                                    Bundle bundle = new Bundle();
                                    bundle.putString("flag", "report");
                                    bundle.putString("contentId", item.getId() + "");
                                    bundle.putString("module", "1");
                                    bundle.putString("type", "1");
                                    bundle.putString("byUserId", item.getUserId() + "");
                                    startActivity(ReportActivity.class, bundle);
                                });
                            }
                        });

                        /**
                         * 分享
                         */
                        childView.findViewById(R.id.share).setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View view) {
                                if (Utils.isDoubleClick()) {
                                    return;
                                }
                                contentId = item.getId();
                                showDialog(context, null);
                                JSONObject jsonObject = new JSONObject();
                                try {
                                    jsonObject.put("contentId", item.getId());
                                    jsonObject.put("module", 1);
                                } catch (JSONException e) {
                                    e.printStackTrace();
                                }
                                finalOkGo.requestHead(RequestType.POSTJSONHEAD, Url.SHARE_DATA, null, jsonObject.toString(), new Callback<ShareDataBean>() {
                                    @Override
                                    public void onSuccess(ShareDataBean shareDataBean) {
                                        dismissDialog();
                                        if (shareDataBean.getCode() == Contacts.SUCCESS) {
                                            showShareDialog(shareDataBean);
                                        } else {
                                            if (shareDataBean.getCode() == Contacts.TOKEN_EMPTY) {
                                            } else {
                                                showImageToas(shareDataBean.getMsg());
                                            }
                                        }

                                    }

                                    @Override
                                    public void onError(Response<String> response) {
                                        super.onError(response);
                                        dismissDialog();
                                    }
                                });
                            }
                        });

                        /**
                         *
                         * 跳转他人中心
                         */
                        childView.findViewById(R.id.head_photo_rl).setOnClickListener(view17 -> {
                            if (Utils.isDoubleClick()) {
                                return;
                            }
                            if (item.getAnonymity() == 1) {
                                showImageToas("匿名用户无法查看主页");
                            } else {
                                Bundle bundle = new Bundle();
                                bundle.putString("userId", item.getUserId() + "");
                                bundle.putString("userName", item.getNickname());
                                startActivity(OtherInfoActivity.class, bundle);
                            }
                        });

                        /**
                         * 详情页点击事件
                         */
                        LinearLayout item_ll = childView.findViewById(R.id.item_ll);
                        item_ll.setOnClickListener(view13 -> {
                            if (Utils.isDoubleClick()) {
                                return;
                            }
                            currentPlayPosition = item.getId();
                            Bundle bundle = new Bundle();
                            bundle.putString("flag", "video_4_3");
                            bundle.putSerializable("data", item);
                            bundle.putInt("position", helper.getAdapterPosition());
                            startActivity(MineInvitationDetailActivity.class, bundle);
                        });
                        item_ll.setTag(helper.getAdapterPosition());

                        /**
                         * 自动弹出评论框后 发送评论
                         */
                        EditText comment_et = childView.findViewById(R.id.comment_et);
                        childView.findViewById(R.id.send).setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View view) {
                                if (Utils.isDoubleClick()) {
                                    return;
                                }
                                if (!TextUtils.isEmpty(comment_et.getText().toString().trim())) {
                                    showDialog(context, "评论中...");
                                    JSONObject jsonObject = new JSONObject();
                                    try {
                                        jsonObject.put("contentId", item.getId());
                                        jsonObject.put("comment", comment_et.getText().toString().trim());
                                        jsonObject.put("position", 1);
                                        jsonObject.put("type", 1);
                                    } catch (JSONException e) {
                                        e.printStackTrace();
                                    }
                                    finalOkGo.requestHead(RequestType.POSTJSONHEAD, Url.COMMENT_SAVE, null, jsonObject.toString(), new Callback<SendCodeBean>() {
                                        @Override
                                        public void onSuccess(SendCodeBean sendCodeBean) {
                                            dismissDialog();
                                            if (sendCodeBean.getCode() == Contacts.SUCCESS) {
                                                if (item.getCommentSum() < 2) {
                                                    item.setCommentSum(item.getCommentSum() + 1);
                                                    MineAllListBean.PageBean.ListBean.CommentListBean commentListBean = new MineAllListBean.PageBean.ListBean.CommentListBean();
                                                    commentListBean.setComment(comment_et.getText().toString().trim());
                                                    commentListBean.setNickname(userInfoBean.getUser().getNickname());
                                                    item.getCommentList().add(commentListBean);
                                                    quickAdapter.notifyDataSetChanged();
                                                } else {
                                                    item.setCommentSum(item.getCommentSum() + 1);
                                                    MineAllListBean.PageBean.ListBean.CommentListBean commentListBean = new MineAllListBean.PageBean.ListBean.CommentListBean();
                                                    commentListBean.setComment(comment_et.getText().toString().trim());
                                                    commentListBean.setNickname(userInfoBean.getUser().getNickname());
                                                    item.getCommentList().set(0, commentListBean);
                                                    quickAdapter.notifyDataSetChanged();
                                                }
                                            } else {
                                                if (sendCodeBean.getCode() == Contacts.TOKEN_EMPTY) {
                                                } else {
                                                    showImageToas(sendCodeBean.getMsg());
                                                }
                                            }
                                        }

                                        @Override
                                        public void onError(Response<String> response) {
                                            super.onError(response);
                                            dismissDialog();
                                        }
                                    });
                                } else {
//                                    showImageToas("请填写点内容吧");
                                }

                            }
                        });

                        /**
                         * 内容
                         */
                        RichTextView content = childView.findViewById(R.id.content);
                        if (!TextUtils.isEmpty(item.getTitle())) {
                            if (!item.getTitle().equals(content.getTag())) {
                                content.setTag(item.getTitle());
                                List<UserModel> list = new ArrayList<>();
                                if (!TextUtils.isEmpty(item.getRemindJson()) && !"[]".equals(item.getRemindJson())) {
                                    List<RemindJson> remindJsons = GsonUtil.jsonToList(item.getRemindJson(), RemindJson.class);
                                    if (remindJsons != null) {
                                        for (int i = 0; i < remindJsons.size(); i++) {
                                            UserModel userModel = new UserModel();
                                            userModel.setUser_name(remindJsons.get(i).getNickname());
                                            userModel.setUser_id(remindJsons.get(i).getUserId() + "");
                                            list.add(userModel);
                                        }
                                    }
                                }


                                content.setVisibility(View.VISIBLE);
//                                content.setText(item.getTitle());

                                //直接使用RichTextView
                                content.setAtColor(Color.parseColor(getString(R.string.remind_color)));
                                content.setLinkColor(Color.BLUE);
                                content.setSpanAtUserCallBackListener(spanAtUserCallBack);
                                //所有配置完成后才设置text
                                content.setRichTextUser(item.getTitle(), list);
                            }
                        } else {
                            content.setVisibility(View.GONE);
                        }

                        /**
                         * 位置
                         */
                        TextView location = childView.findViewById(R.id.location);
                        location.setText(item.getAddress().split("\\|")[0]);
                        location.setTextColor(getResources().getColor(R.color.color_9999));

                        /**
                         * 昵称
                         */
                        TextView name = childView.findViewById(R.id.name);

                        /**
                         * 头像
                         */
                        CircleImageView head_photo = childView.findViewById(R.id.head_photo);
                        if (item.getAnonymity() == 1) {
                            Glide.with(context)
                                    .load("")
                                    .dontAnimate()
                                    .placeholder(R.mipmap.head_anonymous_purple)
                                    .into(head_photo);
                            name.setText("匿名用户");
                        } else {
                            Glide.with(context)
                                    .load(userInfoBean.getUser().getAvatar() + Config.IMAGE_LIM)
                                    .dontAnimate()
                                    .error(R.mipmap.icon_no_head)
                                    .placeholder(R.mipmap.icon_no_head)
                                    .into(head_photo);
                            name.setText(userInfoBean.getUser().getNickname());
                        }

                        /**
                         * 点赞接口
                         */
                        ImageView praise = childView.findViewById(R.id.praise);
                        if (item.getIsLike() == 1) {
                            praise.setImageResource(R.mipmap.icon_praise_select);
                        } else {
                            praise.setImageResource(R.mipmap.item_praise);
                        }
                        praise.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View view) {
                                if (Utils.isDoubleClick()) {
                                    return;
                                }
                                if (item.getIsLike() == 1) {
                                    praise.setEnabled(false);
                                    showDialog(context, "取消中...");
                                    JSONObject jsonObject = new JSONObject();
                                    try {
                                        jsonObject.put("contentId", item.getId());
                                        jsonObject.put("module", 1);
                                    } catch (JSONException e) {
                                        e.printStackTrace();
                                    }
                                    finalOkGo.requestHead(RequestType.POSTJSONHEAD, Url.CANCEL_PRAISE_HOME, null, jsonObject.toString(), new Callback<SendCodeBean>() {
                                        @Override
                                        public void onSuccess(SendCodeBean sendCodeBean) {
                                            dismissDialog();
                                            praise.setEnabled(true);
                                            if (sendCodeBean.getCode() == Contacts.SUCCESS) {
                                                item.setIsLike(0);
                                                item.setLikeSum(item.getLikeSum() - 1);
                                                quickAdapter.notifyDataSetChanged();
                                                EventBus.getDefault().post("refresh_other_list_cancel_praise:" + item.getId());
                                                EventBus.getDefault().post("refresh_mine");
                                            } else {
                                                if (sendCodeBean.getCode() == Contacts.TOKEN_EMPTY) {
                                                } else {
                                                    showImageToas(sendCodeBean.getMsg());
                                                }
                                            }
                                        }

                                        @Override
                                        public void onError(Response<String> response) {
                                            super.onError(response);
                                            dismissDialog();
                                            praise.setEnabled(true);
                                        }
                                    });
                                } else {
                                    praise.setEnabled(false);
                                    showDialog(context, "点赞中...");
                                    JSONObject jsonObject = new JSONObject();
                                    try {
                                        jsonObject.put("contentId", item.getId());
                                        jsonObject.put("module", 1);
                                    } catch (JSONException e) {
                                        e.printStackTrace();
                                    }
                                    finalOkGo.requestHead(RequestType.POSTJSONHEAD, Url.PRAISE_HOME, null, jsonObject.toString(), new Callback<SendCodeBean>() {
                                        @Override
                                        public void onSuccess(SendCodeBean sendCodeBean) {
                                            dismissDialog();
                                            praise.setEnabled(true);
                                            if (sendCodeBean.getCode() == Contacts.SUCCESS) {
                                                item.setIsLike(1);
                                                item.setLikeSum(item.getLikeSum() + 1);
                                                quickAdapter.notifyDataSetChanged();
                                                EventBus.getDefault().post("refresh_other_list_praise:" + item.getId());
                                                EventBus.getDefault().post("refresh_mine");
                                            } else {
                                                if (sendCodeBean.getCode() == Contacts.TOKEN_EMPTY) {
                                                } else {
                                                    showImageToas(sendCodeBean.getMsg());
                                                }
                                            }
                                        }

                                        @Override
                                        public void onError(Response<String> response) {
                                            super.onError(response);
                                            dismissDialog();
                                            praise.setEnabled(true);
                                        }
                                    });
                                }
                            }
                        });

                        /**
                         * 关注和点击事件
                         */
                        TextView follow = childView.findViewById(R.id.follow);
                        follow.setVisibility(View.INVISIBLE);


                        /**
                         * 评论列表
                         */
                        XListView comment_listview = childView.findViewById(R.id.comment_listview);
                        TextView comment_count = childView.findViewById(R.id.comment_count);
                        comment_count.setVisibility(View.GONE);
                        comment_listview.setVisibility(View.GONE);

                        /**
                         * 投票
                         */
                        XListView vote_num_listview = childView.findViewById(R.id.vote_num_listview);
                        if (item.getIsVote() == 0) {
                            vote_num_listview.setVisibility(View.GONE);
                        } else {
                            vote_num_listview.setVisibility(View.VISIBLE);
                            QuickAdapter<ContentVoteListBean> voteAdapter =
                                    new QuickAdapter<ContentVoteListBean>(context, R.layout.item_vote, item.getContentVoteList()) {
                                        @Override
                                        protected void convert(BaseAdapterHelper voteHelper, ContentVoteListBean voteItem) {
                                            TextView vote_tab_yes = voteHelper.getView(R.id.vote_tab_yes);
                                            TextView vote_tab_no = voteHelper.getView(R.id.vote_tab_no);
                                            TextView vote_num = voteHelper.getView(R.id.vote_num);
                                            ProgressBar progressBar = voteHelper.getView(R.id.progressBar);
                                            LinearLayout item_ll = voteHelper.getView(R.id.item_ll);

                                            if ("1".equals(isSelf)) {
                                                vote_tab_yes.setVisibility(View.VISIBLE);
                                                vote_num.setVisibility(View.VISIBLE);
                                                progressBar.setVisibility(View.VISIBLE);
                                                vote_tab_no.setVisibility(View.INVISIBLE);

                                                vote_tab_yes.setText(voteItem.getName());
                                                vote_num.setText(voteItem.getVoteSum() + "票");

                                                progressBar.setMax(item.getVoteTotal());
                                                progressBar.setProgress(voteItem.getVoteSum());
                                            } else {
                                                if (item.getIsVoted() == 1) {
                                                    vote_tab_yes.setVisibility(View.VISIBLE);
                                                    vote_num.setVisibility(View.VISIBLE);
                                                    progressBar.setVisibility(View.VISIBLE);
                                                    vote_tab_no.setVisibility(View.INVISIBLE);

                                                    vote_tab_yes.setText(voteItem.getName());
                                                    vote_num.setText(voteItem.getVoteSum() + "票");

                                                    progressBar.setMax(item.getVoteTotal());
                                                    progressBar.setProgress(voteItem.getVoteSum());
                                                } else {
                                                    vote_tab_yes.setVisibility(View.INVISIBLE);
                                                    vote_num.setVisibility(View.INVISIBLE);
                                                    progressBar.setVisibility(View.INVISIBLE);
                                                    vote_tab_no.setVisibility(View.VISIBLE);

                                                    vote_tab_no.setText(voteItem.getName());
                                                }
                                            }

                                            item_ll.setOnClickListener(new View.OnClickListener() {
                                                @Override
                                                public void onClick(View view) {
                                                    if (Utils.isDoubleClick()) {
                                                        return;
                                                    }
                                                    if (item.getIsVoted() == 1) {
                                                        if (voteItem.getIsVote() == 1) {
                                                            item_ll.setEnabled(false);
                                                            showDialog(context, "取消中...");
                                                            JSONObject jsonObject = new JSONObject();
                                                            try {
                                                                jsonObject.put("contentVoteId", voteItem.getId());
                                                                jsonObject.put("contentId", voteItem.getContentId());
                                                            } catch (JSONException e) {
                                                                e.printStackTrace();
                                                            }
                                                            finalOkGo.requestHead(RequestType.POSTJSONHEAD, Url.CANCE_HOME_VOTE, null, jsonObject.toString(), new Callback<SendCodeBean>() {
                                                                @Override
                                                                public void onSuccess(SendCodeBean sendCodeBean) {
                                                                    dismissDialog();
                                                                    item_ll.setEnabled(true);
                                                                    if (sendCodeBean.getCode() == Contacts.SUCCESS) {
                                                                        item.setIsVoted(0);
                                                                        item.setVoteTotal(item.getVoteTotal() - 1);
                                                                        voteItem.setIsVote(0);
                                                                        voteItem.setVoteSum(voteItem.getVoteSum() - 1);
                                                                        notifyDataSetChanged();
                                                                    } else {
                                                                        if (sendCodeBean.getCode() == Contacts.TOKEN_EMPTY) {
                                                                        } else {
//                                                                                showImageToas(sendCodeBean.getMsg());
                                                                        }
                                                                    }
                                                                }

                                                                @Override
                                                                public void onError(Response<String> response) {
                                                                    super.onError(response);
                                                                    dismissDialog();
                                                                    item_ll.setEnabled(true);
                                                                }
                                                            });
                                                        }
                                                    } else {
                                                        if (voteItem.getIsVote() == 0) {
                                                            item_ll.setEnabled(false);
                                                            showDialog(context, "投票中...");
                                                            JSONObject jsonObject = new JSONObject();
                                                            try {
                                                                jsonObject.put("contentId", voteItem.getContentId());
                                                                jsonObject.put("contentVoteId", voteItem.getId());
                                                            } catch (JSONException e) {
                                                                e.printStackTrace();
                                                            }
                                                            finalOkGo.requestHead(RequestType.POSTJSONHEAD, Url.HOME_VOTE, null, jsonObject.toString(), new Callback<SendCodeBean>() {
                                                                @Override
                                                                public void onSuccess(SendCodeBean sendCodeBean) {
                                                                    dismissDialog();
                                                                    item_ll.setEnabled(true);
                                                                    if (sendCodeBean.getCode() == Contacts.SUCCESS) {
                                                                        item.setIsVoted(1);
                                                                        item.setVoteTotal(item.getVoteTotal() + 1);
                                                                        voteItem.setVoteSum(voteItem.getVoteSum() + 1);
                                                                        voteItem.setIsVote(1);
                                                                        notifyDataSetChanged();
                                                                    } else {
                                                                        if (sendCodeBean.getCode() == Contacts.TOKEN_EMPTY) {
                                                                        } else {
//                                                                                showImageToas(sendCodeBean.getMsg());
                                                                        }
                                                                    }
                                                                }

                                                                @Override
                                                                public void onError(Response<String> response) {
                                                                    super.onError(response);
                                                                    dismissDialog();
                                                                    item_ll.setEnabled(true);
                                                                }
                                                            });
                                                        }
                                                    }
                                                }
                                            });

                                        }
                                    };
                            vote_num_listview.setAdapter(voteAdapter);
                        }

                    } else {
                        /**
                         * 3：2视频
                         */
                        container.removeAllViews();
                        View childView = LayoutInflater.from(context).inflate(R.layout.item_recommend_video_3_2, null, false);
                        container.addView(childView);

                        /**
                         * 点赞和评论数
                         */
                        TextView praise_tv = childView.findViewById(R.id.praise_tv);
                        praise_tv.setText(item.getLikeSum() + "");

                        TextView comment_tv = childView.findViewById(R.id.comment_tv);
                        comment_tv.setText(item.getCommentSum() + "");

                        /**
                         *时间
                         */
                        TextView time = childView.findViewById(R.id.time);
                        timecha(item.getCreateTime(), time);

                        /**
                         * 详情点击事件
                         */
                        LinearLayout item_ll = childView.findViewById(R.id.item_ll);
                        item_ll.setOnClickListener(view14 -> {
                            if (Utils.isDoubleClick()) {
                                return;
                            }
                            currentPlayPosition = item.getId();
                            Bundle bundle = new Bundle();
                            bundle.putString("flag", "video_3_2");
                            bundle.putSerializable("data", item);
                            bundle.putInt("position", helper.getAdapterPosition());
                            startActivity(MineInvitationDetailActivity.class, bundle);
                        });
                        item_ll.setTag(helper.getAdapterPosition());

                        /**
                         * 视频播放和点击事件
                         */
                        ScaleFrameLayout mcontainer = childView.findViewById(R.id.my_container);
                        VideoView myVideoView_3_2 = VideoMineHashMap.getIntance().get(item.getId());
                        mcontainer.removeAllViews();
                        removePlayerFormParent(myVideoView_3_2);
                        mcontainer.addView(myVideoView_3_2);
                        String playUrl = mPreloadManager.getPlayUrl(item.getUrls());
                        myVideoView_3_2.setUrl(playUrl);
                        StandardVideoController controller = new StandardVideoController(context);
                        myVideoView_3_2.setVideoController(controller);
                        controller.setPlayState(myVideoView_3_2.getCurrentPlayState());
                        controller.setPlayerState(myVideoView_3_2.getCurrentPlayerState());
                        Glide.with(context)
                                .load(item.getUrls() + "?vframe/jpg/offset/1")
                                .crossFade()
                                .placeholder(android.R.color.darker_gray)
                                .into(controller.getThumb());
                        myVideoView_3_2.setLooping(true);
                        myVideoView_3_2.setScreenScaleType(VideoView.SCREEN_SCALE_CENTER_CROP);
                        myVideoView_3_2.setMute(true);

                        controller.getThumb().setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View view) {
                                //移除Controller
                                if (Utils.isDoubleClick()) {
                                    return;
                                }
                                myVideoView_3_2.setVideoController(null);
                                currentPlayPosition = item.getId();
                                Bundle bundle = new Bundle();
                                VideoListBean videoListBean = new VideoListBean();
                                videoListBean.setVideoDownloadUrl(item.getUrls());
                                videoListBean.setCoverImgUrl(item.getUrls() + "?vframe/jpg/offset/1");
                                videoListBean.setTitle(item.getTitle());
                                videoListBean.setComment_num(item.getCommentSum());
                                videoListBean.setPraise_num(item.getLikeSum());
                                videoListBean.setHeadPhoto(item.getAvatar());
                                videoListBean.setNickName(item.getNickname());
                                videoListBean.setTime(item.getCreateTime());
                                videoListBean.setIsLike(item.getIsLike());
                                videoListBean.setAnonymity(item.getAnonymity());
                                videoListBean.setUserId(item.getUserId());
                                videoListBean.setContentId(item.getId());
                                List<RemindJson> remindJsons = GsonUtil.jsonToList(item.getRemindJson(), RemindJson.class);
                                videoListBean.setList(remindJsons);
                                bundle.putSerializable("data", videoListBean);
                                bundle.putInt("videoId", item.getId());
                                bundle.putString("categoriesId", item.getCategoriesId() + "");
                                bundle.putString("flag", "mineAll");
                                startActivity(VideoDetailActivity.class, bundle);
                            }
                        });

                        controller.findViewById(R.id.start_play).setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View view) {
                                //移除Controller
                                if (Utils.isDoubleClick()) {
                                    return;
                                }
                                myVideoView_3_2.setVideoController(null);
                                currentPlayPosition = item.getId();
                                Bundle bundle = new Bundle();
                                VideoListBean videoListBean = new VideoListBean();
                                videoListBean.setVideoDownloadUrl(item.getUrls());
                                videoListBean.setCoverImgUrl(item.getUrls() + "?vframe/jpg/offset/1");
                                videoListBean.setTitle(item.getTitle());
                                videoListBean.setComment_num(item.getCommentSum());
                                videoListBean.setPraise_num(item.getLikeSum());
                                videoListBean.setHeadPhoto(item.getAvatar());
                                videoListBean.setNickName(item.getNickname());
                                videoListBean.setTime(item.getCreateTime());
                                videoListBean.setIsLike(item.getIsLike());
                                videoListBean.setAnonymity(item.getAnonymity());
                                videoListBean.setUserId(item.getUserId());
                                videoListBean.setContentId(item.getId());
                                List<RemindJson> remindJsons = GsonUtil.jsonToList(item.getRemindJson(), RemindJson.class);
                                videoListBean.setList(remindJsons);
                                bundle.putSerializable("data", videoListBean);
                                bundle.putInt("videoId", item.getId());
                                bundle.putString("categoriesId", item.getCategoriesId() + "");
                                bundle.putString("flag", "mineAll");
                                startActivity(VideoDetailActivity.class, bundle);
                            }
                        });

                        controller.setOnClickListener(view12 -> {
                            //移除Controller
                            if (Utils.isDoubleClick()) {
                                return;
                            }
                            myVideoView_3_2.setVideoController(null);
                            currentPlayPosition = item.getId();
                            Bundle bundle = new Bundle();
                            VideoListBean videoListBean = new VideoListBean();
                            videoListBean.setVideoDownloadUrl(item.getUrls());
                            videoListBean.setCoverImgUrl(item.getUrls() + "?vframe/jpg/offset/1");
                            videoListBean.setTitle(item.getTitle());
                            videoListBean.setComment_num(item.getCommentSum());
                            videoListBean.setPraise_num(item.getLikeSum());
                            videoListBean.setHeadPhoto(item.getAvatar());
                            videoListBean.setNickName(item.getNickname());
                            videoListBean.setTime(item.getCreateTime());
                            videoListBean.setIsLike(item.getIsLike());
                            videoListBean.setAnonymity(item.getAnonymity());
                            videoListBean.setUserId(item.getUserId());
                            videoListBean.setContentId(item.getId());
                            List<RemindJson> remindJsons = GsonUtil.jsonToList(item.getRemindJson(), RemindJson.class);
                            videoListBean.setList(remindJsons);
                            bundle.putSerializable("data", videoListBean);
                            bundle.putInt("videoId", item.getId());
                            bundle.putString("categoriesId", item.getCategoriesId() + "");
                            bundle.putString("flag", "mineAll");
                            startActivity(VideoDetailActivity.class, bundle);
                        });

                        childView.findViewById(R.id.more).setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View view) {
                                if (Utils.isDoubleClick()) {
                                    return;
                                }
                                DialogUtil.getInstance().showCenterDialog(context, R.layout.dialog_more);
                                LinearLayout dialog_more = (LinearLayout) DialogUtil.getInstance().dialog_center_layout;
                                LinearLayout cancel_follow = dialog_more.findViewById(R.id.cancel_follow);
                                LinearLayout delete = dialog_more.findViewById(R.id.delete);
                                LinearLayout report = dialog_more.findViewById(R.id.report);
                                LinearLayout black_list = dialog_more.findViewById(R.id.black_list);

                                View line = dialog_more.findViewById(R.id.line);
                                View viewline = dialog_more.findViewById(R.id.view);
                                View view1 = dialog_more.findViewById(R.id.view1);

                                if ("1".equals(isSelf)) {
                                    report.setVisibility(View.GONE);
                                    black_list.setVisibility(View.GONE);
                                    cancel_follow.setVisibility(View.GONE);
                                    line.setVisibility(View.GONE);
                                    viewline.setVisibility(View.GONE);
                                    view1.setVisibility(View.INVISIBLE);
                                    delete.setVisibility(View.VISIBLE);
                                } else {
                                    cancel_follow.setVisibility(View.GONE);
                                    line.setVisibility(View.GONE);
                                    viewline.setVisibility(View.GONE);
                                    view1.setVisibility(View.INVISIBLE);
                                    report.setVisibility(View.VISIBLE);
                                    black_list.setVisibility(View.GONE);
                                    delete.setVisibility(View.GONE);
                                }

                                delete.setOnClickListener(new View.OnClickListener() {
                                    @Override
                                    public void onClick(View view) {
                                        if (Utils.isDoubleClick()) {
                                            return;
                                        }
                                        DialogUtil.getInstance().dialog_center.dismiss();
                                        showDialog(context, "删除中...");
                                        HttpParams params = new HttpParams();
                                        params.put("contentId", item.getId());
                                        finalOkGo.requestHead(RequestType.POSTHEAD, Url.DELETE_CONTENT, params, Url.DELETE_CONTENT, new Callback<SendCodeBean>() {
                                            @Override
                                            public void onSuccess(SendCodeBean sendCodeBean) {
                                                dismissDialog();
                                                if (sendCodeBean.getCode() == Contacts.SUCCESS) {
                                                    quickAdapter.remove(helper.getAdapterPosition());
                                                    quickAdapter.notifyDataSetChanged();
                                                } else {
                                                    if (sendCodeBean.getCode() == Contacts.TOKEN_EMPTY) {
                                                    } else {
                                                        showImageToas(sendCodeBean.getMsg());
                                                    }
                                                }
                                            }

                                            @Override
                                            public void onError(Response<String> response) {
                                                super.onError(response);
                                                dismissDialog();
                                            }
                                        });
                                    }
                                });

                                report.setOnClickListener(view19 -> {
                                    if (Utils.isDoubleClick()) {
                                        return;
                                    }
                                    DialogUtil.getInstance().dialog_center.dismiss();
                                    Bundle bundle = new Bundle();
                                    bundle.putString("flag", "report");
                                    bundle.putString("contentId", item.getId() + "");
                                    bundle.putString("module", "1");
                                    bundle.putString("type", "1");
                                    bundle.putString("byUserId", item.getUserId() + "");
                                    startActivity(ReportActivity.class, bundle);
                                });

                            }
                        });

                        /**
                         * 分享
                         */
                        childView.findViewById(R.id.share).setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View view) {
                                if (Utils.isDoubleClick()) {
                                    return;
                                }
                                contentId = item.getId();
                                showDialog(context, null);
                                JSONObject jsonObject = new JSONObject();
                                try {
                                    jsonObject.put("contentId", item.getId());
                                    jsonObject.put("module", 1);
                                } catch (JSONException e) {
                                    e.printStackTrace();
                                }
                                finalOkGo.requestHead(RequestType.POSTJSONHEAD, Url.SHARE_DATA, null, jsonObject.toString(), new Callback<ShareDataBean>() {
                                    @Override
                                    public void onSuccess(ShareDataBean shareDataBean) {
                                        dismissDialog();
                                        if (shareDataBean.getCode() == Contacts.SUCCESS) {
                                            showShareDialog(shareDataBean);
                                        } else {
                                            if (shareDataBean.getCode() == Contacts.TOKEN_EMPTY) {
                                            } else {
                                                showImageToas(shareDataBean.getMsg());
                                            }
                                        }

                                    }

                                    @Override
                                    public void onError(Response<String> response) {
                                        super.onError(response);
                                        dismissDialog();
                                    }
                                });

                            }
                        });

                        /**
                         *
                         * 跳转他人中心
                         */
                        childView.findViewById(R.id.head_photo_rl).setOnClickListener(view17 -> {
                            if (Utils.isDoubleClick()) {
                                return;
                            }
                            if (item.getAnonymity() == 1) {
                                showImageToas("匿名用户无法查看主页");
                            } else {
                                Bundle bundle = new Bundle();
                                bundle.putString("userId", item.getUserId() + "");
                                bundle.putString("userName", item.getNickname());
                                startActivity(OtherInfoActivity.class, bundle);
                            }
                        });


                        /**
                         * 评论按钮点击事件跳转详情
                         */
                        ImageView comment = childView.findViewById(R.id.comment);
                        comment.setOnClickListener(view1 -> {
                            if (Utils.isDoubleClick()) {
                                return;
                            }
                            currentPlayPosition = item.getId();
                            Bundle bundle = new Bundle();
                            bundle.putString("flag", "video_3_2");
                            bundle.putSerializable("data", item);
                            bundle.putInt("position", helper.getAdapterPosition());
                            startActivity(MineInvitationDetailActivity.class, bundle);
                        });

                        /**
                         * 评论框
                         */
                        EditText comment_et = childView.findViewById(R.id.comment_et);
                        childView.findViewById(R.id.send).setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View view) {
                                if (Utils.isDoubleClick()) {
                                    return;
                                }
                                if (!TextUtils.isEmpty(comment_et.getText().toString().trim())) {
                                    showDialog(context, "评论中...");
                                    JSONObject jsonObject = new JSONObject();
                                    try {
                                        jsonObject.put("contentId", item.getId());
                                        jsonObject.put("comment", comment_et.getText().toString().trim());
                                        jsonObject.put("position", 1);
                                        jsonObject.put("type", 1);
                                    } catch (JSONException e) {
                                        e.printStackTrace();
                                    }
                                    finalOkGo.requestHead(RequestType.POSTJSONHEAD, Url.COMMENT_SAVE, null, jsonObject.toString(), new Callback<SendCodeBean>() {
                                        @Override
                                        public void onSuccess(SendCodeBean sendCodeBean) {
                                            dismissDialog();
                                            if (sendCodeBean.getCode() == Contacts.SUCCESS) {
                                                if (item.getCommentSum() < 2) {
                                                    item.setCommentSum(item.getCommentSum() + 1);
                                                    MineAllListBean.PageBean.ListBean.CommentListBean commentListBean = new MineAllListBean.PageBean.ListBean.CommentListBean();
                                                    commentListBean.setComment(comment_et.getText().toString().trim());
                                                    commentListBean.setNickname(userInfoBean.getUser().getNickname());
                                                    item.getCommentList().add(commentListBean);
                                                    quickAdapter.notifyDataSetChanged();
                                                } else {
                                                    item.setCommentSum(item.getCommentSum() + 1);
                                                    MineAllListBean.PageBean.ListBean.CommentListBean commentListBean = new MineAllListBean.PageBean.ListBean.CommentListBean();
                                                    commentListBean.setComment(comment_et.getText().toString().trim());
                                                    commentListBean.setNickname(userInfoBean.getUser().getNickname());
                                                    item.getCommentList().set(0, commentListBean);
                                                    quickAdapter.notifyDataSetChanged();
                                                }
                                            } else {
                                                if (sendCodeBean.getCode() == Contacts.TOKEN_EMPTY) {
                                                } else {
                                                    showImageToas(sendCodeBean.getMsg());
                                                }
                                            }
                                        }

                                        @Override
                                        public void onError(Response<String> response) {
                                            super.onError(response);
                                            dismissDialog();
                                        }
                                    });
                                } else {
//                                    showImageToas("请填写点内容吧");
                                }

                            }
                        });

                        /**
                         * 内容
                         */
                        RichTextView content = childView.findViewById(R.id.content);
                        if (!TextUtils.isEmpty(item.getTitle())) {
                            if (!item.getTitle().equals(content.getTag())) {
                                content.setTag(item.getTitle());
                                List<UserModel> list = new ArrayList<>();
                                if (!TextUtils.isEmpty(item.getRemindJson()) && !"[]".equals(item.getRemindJson())) {
                                    List<RemindJson> remindJsons = GsonUtil.jsonToList(item.getRemindJson(), RemindJson.class);
                                    if (remindJsons != null) {
                                        for (int i = 0; i < remindJsons.size(); i++) {
                                            UserModel userModel = new UserModel();
                                            userModel.setUser_name(remindJsons.get(i).getNickname());
                                            userModel.setUser_id(remindJsons.get(i).getUserId() + "");
                                            list.add(userModel);
                                        }
                                    }
                                }

                                content.setVisibility(View.VISIBLE);
//                                content.setText(item.getTitle());

                                //直接使用RichTextView
                                content.setAtColor(Color.parseColor(getString(R.string.remind_color)));
                                content.setLinkColor(Color.BLUE);
                                content.setSpanAtUserCallBackListener(spanAtUserCallBack);
                                //所有配置完成后才设置text
                                content.setRichTextUser(item.getTitle(), list);
                            }
                        } else {
                            content.setVisibility(View.GONE);
                        }

                        /**
                         * 位置
                         */
                        TextView location = childView.findViewById(R.id.location);
                        location.setText(item.getAddress().split("\\|")[0]);
                        location.setTextColor(getResources().getColor(R.color.color_9999));

                        /**
                         * 昵称
                         */
                        TextView name = childView.findViewById(R.id.name);

                        /**
                         * 头像
                         */
                        CircleImageView head_photo = childView.findViewById(R.id.head_photo);
                        if (item.getAnonymity() == 1) {
                            Glide.with(context)
                                    .load("")
                                    .dontAnimate()
                                    .placeholder(R.mipmap.head_anonymous_purple)
                                    .into(head_photo);
                            name.setText("匿名用户");
                        } else {
                            Glide.with(context)
                                    .load(userInfoBean.getUser().getAvatar() + Config.IMAGE_LIM)
                                    .dontAnimate()
                                    .error(R.mipmap.icon_no_head)
                                    .placeholder(R.mipmap.icon_no_head)
                                    .into(head_photo);
                            name.setText(userInfoBean.getUser().getNickname());
                        }

                        /**
                         * 点赞接口
                         */
                        ImageView praise = childView.findViewById(R.id.praise);
                        if (item.getIsLike() == 1) {
                            praise.setImageResource(R.mipmap.icon_praise_select);
                        } else {
                            praise.setImageResource(R.mipmap.item_praise);
                        }
                        praise.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View view) {
//                                if (item.getStatus() == 0) {
//                                    showImageToas("动态正在审核中");
//                                    return;
//                                }
                                if (Utils.isDoubleClick()) {
                                    return;
                                }
                                if (item.getIsLike() == 1) {
                                    praise.setEnabled(false);
                                    showDialog(context, "取消中...");
                                    JSONObject jsonObject = new JSONObject();
                                    try {
                                        jsonObject.put("contentId", item.getId());
                                        jsonObject.put("module", 1);
                                    } catch (JSONException e) {
                                        e.printStackTrace();
                                    }
                                    finalOkGo.requestHead(RequestType.POSTJSONHEAD, Url.CANCEL_PRAISE_HOME, null, jsonObject.toString(), new Callback<SendCodeBean>() {
                                        @Override
                                        public void onSuccess(SendCodeBean sendCodeBean) {
                                            dismissDialog();
                                            if (sendCodeBean.getCode() == Contacts.SUCCESS) {
                                                item.setIsLike(0);
                                                item.setLikeSum(item.getLikeSum() - 1);
                                                quickAdapter.notifyDataSetChanged();
                                                EventBus.getDefault().post("refresh_other_list_cancel_praise:" + item.getId());
                                                EventBus.getDefault().post("refresh_mine");
                                            } else {
                                                praise.setEnabled(true);
                                                if (sendCodeBean.getCode() == Contacts.TOKEN_EMPTY) {
                                                } else {
                                                    showImageToas(sendCodeBean.getMsg());
                                                }
                                            }
                                        }

                                        @Override
                                        public void onError(Response<String> response) {
                                            super.onError(response);
                                            dismissDialog();
                                            praise.setEnabled(true);
                                        }
                                    });
                                } else {
                                    praise.setEnabled(false);
                                    showDialog(context, "点赞中...");
                                    JSONObject jsonObject = new JSONObject();
                                    try {
                                        jsonObject.put("contentId", item.getId());
                                        jsonObject.put("module", 1);
                                    } catch (JSONException e) {
                                        e.printStackTrace();
                                    }
                                    finalOkGo.requestHead(RequestType.POSTJSONHEAD, Url.PRAISE_HOME, null, jsonObject.toString(), new Callback<SendCodeBean>() {
                                        @Override
                                        public void onSuccess(SendCodeBean sendCodeBean) {
                                            dismissDialog();
                                            if (sendCodeBean.getCode() == Contacts.SUCCESS) {
                                                item.setIsLike(1);
                                                item.setLikeSum(item.getLikeSum() + 1);
                                                quickAdapter.notifyDataSetChanged();
                                                EventBus.getDefault().post("refresh_other_list_praise:" + item.getId());
                                                EventBus.getDefault().post("refresh_mine");
                                            } else {
                                                praise.setEnabled(true);
                                                if (sendCodeBean.getCode() == Contacts.TOKEN_EMPTY) {
                                                } else {
                                                    showImageToas(sendCodeBean.getMsg());
                                                }
                                            }
                                        }

                                        @Override
                                        public void onError(Response<String> response) {
                                            super.onError(response);
                                            dismissDialog();
                                            praise.setEnabled(true);
                                        }
                                    });
                                }
                            }
                        });

                        /**
                         * 关注和点击事件
                         */
                        TextView follow = childView.findViewById(R.id.follow);
                        follow.setVisibility(View.INVISIBLE);

                        /**
                         * 评论列表
                         */
                        XListView comment_listview = childView.findViewById(R.id.comment_listview);
                        TextView comment_count = childView.findViewById(R.id.comment_count);
                        comment_count.setVisibility(View.GONE);
                        comment_listview.setVisibility(View.GONE);

                        /**
                         * 投票
                         */
                        XListView vote_num_listview = childView.findViewById(R.id.vote_num_listview);
                        if (item.getIsVote() == 0) {
                            vote_num_listview.setVisibility(View.GONE);
                        } else {
                            vote_num_listview.setVisibility(View.VISIBLE);
                            QuickAdapter<ContentVoteListBean> voteAdapter =
                                    new QuickAdapter<ContentVoteListBean>(context, R.layout.item_vote, item.getContentVoteList()) {
                                        @Override
                                        protected void convert(BaseAdapterHelper voteHelper, ContentVoteListBean voteItem) {
                                            TextView vote_tab_yes = voteHelper.getView(R.id.vote_tab_yes);
                                            TextView vote_tab_no = voteHelper.getView(R.id.vote_tab_no);
                                            TextView vote_num = voteHelper.getView(R.id.vote_num);
                                            ProgressBar progressBar = voteHelper.getView(R.id.progressBar);
                                            LinearLayout item_ll = voteHelper.getView(R.id.item_ll);

                                            if ("1".equals(isSelf)) {
                                                vote_tab_yes.setVisibility(View.VISIBLE);
                                                vote_num.setVisibility(View.VISIBLE);
                                                progressBar.setVisibility(View.VISIBLE);
                                                vote_tab_no.setVisibility(View.INVISIBLE);

                                                vote_tab_yes.setText(voteItem.getName());
                                                vote_num.setText(voteItem.getVoteSum() + "票");

                                                progressBar.setMax(item.getVoteTotal());
                                                progressBar.setProgress(voteItem.getVoteSum());
                                            } else {
                                                if (item.getIsVoted() == 1) {
                                                    vote_tab_yes.setVisibility(View.VISIBLE);
                                                    vote_num.setVisibility(View.VISIBLE);
                                                    progressBar.setVisibility(View.VISIBLE);
                                                    vote_tab_no.setVisibility(View.INVISIBLE);

                                                    vote_tab_yes.setText(voteItem.getName());
                                                    vote_num.setText(voteItem.getVoteSum() + "票");

                                                    progressBar.setMax(item.getVoteTotal());
                                                    progressBar.setProgress(voteItem.getVoteSum());
                                                } else {
                                                    vote_tab_yes.setVisibility(View.INVISIBLE);
                                                    vote_num.setVisibility(View.INVISIBLE);
                                                    progressBar.setVisibility(View.INVISIBLE);
                                                    vote_tab_no.setVisibility(View.VISIBLE);

                                                    vote_tab_no.setText(voteItem.getName());
                                                }
                                            }

                                            item_ll.setOnClickListener(new View.OnClickListener() {
                                                @Override
                                                public void onClick(View view) {
                                                    if (Utils.isDoubleClick()) {
                                                        return;
                                                    }
                                                    if (item.getIsVoted() == 1) {
                                                        if (voteItem.getIsVote() == 1) {
                                                            item_ll.setEnabled(false);
                                                            showDialog(context, "取消中...");
                                                            JSONObject jsonObject = new JSONObject();
                                                            try {
                                                                jsonObject.put("contentVoteId", voteItem.getId());
                                                                jsonObject.put("contentId", voteItem.getContentId());
                                                            } catch (JSONException e) {
                                                                e.printStackTrace();
                                                            }
                                                            finalOkGo.requestHead(RequestType.POSTJSONHEAD, Url.CANCE_HOME_VOTE, null, jsonObject.toString(), new Callback<SendCodeBean>() {
                                                                @Override
                                                                public void onSuccess(SendCodeBean sendCodeBean) {
                                                                    dismissDialog();
                                                                    item_ll.setEnabled(true);
                                                                    if (sendCodeBean.getCode() == Contacts.SUCCESS) {
                                                                        item.setIsVoted(0);
                                                                        item.setVoteTotal(item.getVoteTotal() - 1);
                                                                        voteItem.setIsVote(0);
                                                                        voteItem.setVoteSum(voteItem.getVoteSum() - 1);
                                                                        notifyDataSetChanged();
                                                                    } else {
                                                                        if (sendCodeBean.getCode() == Contacts.TOKEN_EMPTY) {
                                                                        } else {
//                                                                                showImageToas(sendCodeBean.getMsg());
                                                                        }
                                                                    }
                                                                }

                                                                @Override
                                                                public void onError(Response<String> response) {
                                                                    super.onError(response);
                                                                    dismissDialog();
                                                                    item_ll.setEnabled(true);
                                                                }
                                                            });
                                                        }
                                                    } else {
                                                        if (voteItem.getIsVote() == 0) {
                                                            item_ll.setEnabled(false);
                                                            showDialog(context, "投票中...");
                                                            JSONObject jsonObject = new JSONObject();
                                                            try {
                                                                jsonObject.put("contentId", voteItem.getContentId());
                                                                jsonObject.put("contentVoteId", voteItem.getId());
                                                            } catch (JSONException e) {
                                                                e.printStackTrace();
                                                            }
                                                            finalOkGo.requestHead(RequestType.POSTJSONHEAD, Url.HOME_VOTE, null, jsonObject.toString(), new Callback<SendCodeBean>() {
                                                                @Override
                                                                public void onSuccess(SendCodeBean sendCodeBean) {
                                                                    dismissDialog();
                                                                    item_ll.setEnabled(true);
                                                                    if (sendCodeBean.getCode() == Contacts.SUCCESS) {
                                                                        item.setIsVoted(1);
                                                                        item.setVoteTotal(item.getVoteTotal() + 1);
                                                                        voteItem.setVoteSum(voteItem.getVoteSum() + 1);
                                                                        voteItem.setIsVote(1);
                                                                        notifyDataSetChanged();
                                                                    } else {
                                                                        if (sendCodeBean.getCode() == Contacts.TOKEN_EMPTY) {
                                                                        } else {
//                                                                                showImageToas(sendCodeBean.getMsg());
                                                                        }
                                                                    }
                                                                }

                                                                @Override
                                                                public void onError(Response<String> response) {
                                                                    super.onError(response);
                                                                    dismissDialog();
                                                                    item_ll.setEnabled(true);
                                                                }
                                                            });
                                                        }
                                                    }
                                                }
                                            });


                                        }
                                    };
                            vote_num_listview.setAdapter(voteAdapter);
                        }

                    }

                } else if (item.getType() == 2) {
                    /**
                     * 图片
                     */
                    container.removeAllViews();
                    View childView = LayoutInflater.from(context).inflate(R.layout.item_recommend_img, null, false);
                    container.addView(childView);

                    /**
                     * 点赞和评论数
                     */
                    TextView praise_tv = childView.findViewById(R.id.praise_tv);
                    praise_tv.setText(item.getLikeSum() + "");

                    TextView comment_tv = childView.findViewById(R.id.comment_tv);
                    comment_tv.setText(item.getCommentSum() + "");

                    /**
                     *时间
                     */
                    TextView time = childView.findViewById(R.id.time);
                    timecha(item.getCreateTime(), time);

                    /**
                     * 详情点击事件
                     */
                    LinearLayout item_ll = childView.findViewById(R.id.item_ll);
                    item_ll.setOnClickListener(view15 -> {
                        if (Utils.isDoubleClick()) {
                            return;
                        }
                        Bundle bundle = new Bundle();
                        bundle.putString("flag", "img");
                        bundle.putSerializable("data", item);
                        bundle.putInt("position", helper.getAdapterPosition());
                        startActivity(MineInvitationDetailActivity.class, bundle);
                    });
                    item_ll.setTag(helper.getAdapterPosition());

                    childView.findViewById(R.id.more).setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            if (Utils.isDoubleClick()) {
                                return;
                            }
                            DialogUtil.getInstance().showCenterDialog(context, R.layout.dialog_more);
                            LinearLayout dialog_more = (LinearLayout) DialogUtil.getInstance().dialog_center_layout;
                            LinearLayout cancel_follow = dialog_more.findViewById(R.id.cancel_follow);
                            LinearLayout delete = dialog_more.findViewById(R.id.delete);
                            LinearLayout report = dialog_more.findViewById(R.id.report);
                            LinearLayout black_list = dialog_more.findViewById(R.id.black_list);

                            View line = dialog_more.findViewById(R.id.line);
                            View viewline = dialog_more.findViewById(R.id.view);
                            View view1 = dialog_more.findViewById(R.id.view1);

                            if ("1".equals(isSelf)) {
                                report.setVisibility(View.GONE);
                                black_list.setVisibility(View.GONE);
                                cancel_follow.setVisibility(View.GONE);
                                line.setVisibility(View.GONE);
                                viewline.setVisibility(View.GONE);
                                view1.setVisibility(View.INVISIBLE);
                                delete.setVisibility(View.VISIBLE);
                            } else {
                                cancel_follow.setVisibility(View.GONE);
                                line.setVisibility(View.GONE);
                                viewline.setVisibility(View.GONE);
                                view1.setVisibility(View.INVISIBLE);
                                report.setVisibility(View.VISIBLE);
                                black_list.setVisibility(View.GONE);
                                delete.setVisibility(View.GONE);
                            }

                            delete.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View view) {
                                    if (Utils.isDoubleClick()) {
                                        return;
                                    }
                                    DialogUtil.getInstance().dialog_center.dismiss();
                                    showDialog(context, "删除中...");
                                    HttpParams params = new HttpParams();
                                    params.put("contentId", item.getId());
                                    finalOkGo.requestHead(RequestType.POSTHEAD, Url.DELETE_CONTENT, params, Url.DELETE_CONTENT, new Callback<SendCodeBean>() {
                                        @Override
                                        public void onSuccess(SendCodeBean sendCodeBean) {
                                            dismissDialog();
                                            if (sendCodeBean.getCode() == Contacts.SUCCESS) {
                                                quickAdapter.remove(helper.getAdapterPosition());
                                                quickAdapter.notifyDataSetChanged();
                                            } else {
                                                if (sendCodeBean.getCode() == Contacts.TOKEN_EMPTY) {
                                                } else {
                                                    showImageToas(sendCodeBean.getMsg());
                                                }
                                            }
                                        }

                                        @Override
                                        public void onError(Response<String> response) {
                                            super.onError(response);
                                            dismissDialog();
                                        }
                                    });
                                }
                            });

                            report.setOnClickListener(view19 -> {
                                if (Utils.isDoubleClick()) {
                                    return;
                                }
                                DialogUtil.getInstance().dialog_center.dismiss();
                                Bundle bundle = new Bundle();
                                bundle.putString("flag", "report");
                                bundle.putString("contentId", item.getId() + "");
                                bundle.putString("module", "1");
                                bundle.putString("type", "1");
                                bundle.putString("byUserId", item.getUserId() + "");
                                startActivity(ReportActivity.class, bundle);
                            });
                        }
                    });

                    /**
                     * 分享
                     */
                    childView.findViewById(R.id.share).setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            if (Utils.isDoubleClick()) {
                                return;
                            }
                            contentId = item.getId();
                            showDialog(context, null);
                            JSONObject jsonObject = new JSONObject();
                            try {
                                jsonObject.put("contentId", item.getId());
                                jsonObject.put("module", 1);
                            } catch (JSONException e) {
                                e.printStackTrace();
                            }
                            finalOkGo.requestHead(RequestType.POSTJSONHEAD, Url.SHARE_DATA, null, jsonObject.toString(), new Callback<ShareDataBean>() {
                                @Override
                                public void onSuccess(ShareDataBean shareDataBean) {
                                    dismissDialog();
                                    if (shareDataBean.getCode() == Contacts.SUCCESS) {
                                        showShareDialog(shareDataBean);
                                    } else {
                                        if (shareDataBean.getCode() == Contacts.TOKEN_EMPTY) {
                                        } else {
                                            showImageToas(shareDataBean.getMsg());
                                        }
                                    }

                                }

                                @Override
                                public void onError(Response<String> response) {
                                    super.onError(response);
                                    dismissDialog();
                                }
                            });

                        }
                    });

                    /**
                     *
                     * 跳转他人中心
                     */
                    childView.findViewById(R.id.head_photo_rl).setOnClickListener(view17 -> {
                        if (Utils.isDoubleClick()) {
                            return;
                        }
                        if (item.getAnonymity() == 1) {
                            showImageToas("匿名用户无法查看主页");
                        } else {
                            Bundle bundle = new Bundle();
                            bundle.putString("userId", item.getUserId() + "");
                            bundle.putString("userName", item.getNickname());
                            startActivity(OtherInfoActivity.class, bundle);
                        }
                    });


                    /**
                     * 评论按钮点击事件跳转详情
                     */
                    ImageView comment = childView.findViewById(R.id.comment);
                    comment.setOnClickListener(view1 -> {
                        if (Utils.isDoubleClick()) {
                            return;
                        }
                        Bundle bundle = new Bundle();
                        bundle.putString("flag", "img");
                        bundle.putSerializable("data", item);
                        bundle.putInt("position", helper.getAdapterPosition());
                        startActivity(MineInvitationDetailActivity.class, bundle);
                    });

                    /**
                     * 评论框
                     */
                    EditText comment_et = childView.findViewById(R.id.comment_et);
                    childView.findViewById(R.id.send).setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            if (Utils.isDoubleClick()) {
                                return;
                            }
                            if (!TextUtils.isEmpty(comment_et.getText().toString().trim())) {
                                showDialog(context, "评论中...");
                                JSONObject jsonObject = new JSONObject();
                                try {
                                    jsonObject.put("contentId", item.getId());
                                    jsonObject.put("comment", comment_et.getText().toString().trim());
                                    jsonObject.put("position", 1);
                                    jsonObject.put("type", 1);
                                } catch (JSONException e) {
                                    e.printStackTrace();
                                }
                                finalOkGo.requestHead(RequestType.POSTJSONHEAD, Url.COMMENT_SAVE, null, jsonObject.toString(), new Callback<SendCodeBean>() {
                                    @Override
                                    public void onSuccess(SendCodeBean sendCodeBean) {
                                        dismissDialog();
                                        if (sendCodeBean.getCode() == Contacts.SUCCESS) {
                                            if (item.getCommentSum() < 2) {
                                                item.setCommentSum(item.getCommentSum() + 1);
                                                MineAllListBean.PageBean.ListBean.CommentListBean commentListBean = new MineAllListBean.PageBean.ListBean.CommentListBean();
                                                commentListBean.setComment(comment_et.getText().toString().trim());
                                                commentListBean.setNickname(userInfoBean.getUser().getNickname());
                                                item.getCommentList().add(commentListBean);
                                                quickAdapter.notifyDataSetChanged();
                                            } else {
                                                item.setCommentSum(item.getCommentSum() + 1);
                                                MineAllListBean.PageBean.ListBean.CommentListBean commentListBean = new MineAllListBean.PageBean.ListBean.CommentListBean();
                                                commentListBean.setComment(comment_et.getText().toString().trim());
                                                commentListBean.setNickname(userInfoBean.getUser().getNickname());
                                                item.getCommentList().set(0, commentListBean);
                                                quickAdapter.notifyDataSetChanged();
                                            }
                                        } else {
                                            if (sendCodeBean.getCode() == Contacts.TOKEN_EMPTY) {
                                            } else {
                                                showImageToas(sendCodeBean.getMsg());
                                            }
                                        }
                                    }

                                    @Override
                                    public void onError(Response<String> response) {
                                        super.onError(response);
                                        dismissDialog();
                                    }
                                });
                            } else {
//                                showImageToas("请填写点内容吧");
                            }

                        }
                    });

                    /**
                     * 内容
                     */
                    RichTextView content = childView.findViewById(R.id.content);
                    if (!TextUtils.isEmpty(item.getTitle())) {
                        if (!item.getTitle().equals(content.getTag())) {
                            content.setTag(item.getTitle());
                            List<UserModel> list = new ArrayList<>();
                            if (!TextUtils.isEmpty(item.getRemindJson()) && !"[]".equals(item.getRemindJson())) {
                                List<RemindJson> remindJsons = GsonUtil.jsonToList(item.getRemindJson(), RemindJson.class);
                                if (remindJsons != null) {
                                    for (int i = 0; i < remindJsons.size(); i++) {
                                        UserModel userModel = new UserModel();
                                        userModel.setUser_name(remindJsons.get(i).getNickname());
                                        userModel.setUser_id(remindJsons.get(i).getUserId() + "");
                                        list.add(userModel);
                                    }
                                }
                            }

                            content.setVisibility(View.VISIBLE);
//                                content.setText(item.getTitle());

                            //直接使用RichTextView
                            content.setAtColor(Color.parseColor(getString(R.string.remind_color)));
                            content.setLinkColor(Color.BLUE);
                            content.setSpanAtUserCallBackListener(spanAtUserCallBack);
                            //所有配置完成后才设置text
                            content.setRichTextUser(item.getTitle(), list);
                        }
                    } else {
                        content.setVisibility(View.GONE);
                    }

                    /**
                     * 位置
                     */
                    TextView location = childView.findViewById(R.id.location);
                    location.setText(item.getAddress().split("\\|")[0]);
                    location.setTextColor(getResources().getColor(R.color.color_9999));

                    /**
                     * 昵称
                     */
                    TextView name = childView.findViewById(R.id.name);

                    /**
                     * 头像
                     */
                    CircleImageView head_photo = childView.findViewById(R.id.head_photo);
                    if (item.getAnonymity() == 1) {
                        Glide.with(context)
                                .load("")
                                .dontAnimate()
                                .placeholder(R.mipmap.head_anonymous_purple)
                                .into(head_photo);
                        name.setText("匿名用户");
                    } else {
                        Glide.with(context)
                                .load(userInfoBean.getUser().getAvatar() + Config.IMAGE_LIM)
                                .dontAnimate()
                                .error(R.mipmap.icon_no_head)
                                .placeholder(R.mipmap.icon_no_head)
                                .into(head_photo);
                        name.setText(userInfoBean.getUser().getNickname());
                    }

                    /**
                     * 点赞接口
                     */
                    ImageView praise = childView.findViewById(R.id.praise);
                    if (item.getIsLike() == 1) {
                        praise.setImageResource(R.mipmap.icon_praise_select);
                    } else {
                        praise.setImageResource(R.mipmap.item_praise);
                    }
                    praise.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            if (Utils.isDoubleClick()) {
                                return;
                            }
                            if (item.getIsLike() == 1) {
                                praise.setEnabled(false);
                                showDialog(context, "取消中...");
                                JSONObject jsonObject = new JSONObject();
                                try {
                                    jsonObject.put("contentId", item.getId());
                                    jsonObject.put("module", 1);
                                } catch (JSONException e) {
                                    e.printStackTrace();
                                }
                                finalOkGo.requestHead(RequestType.POSTJSONHEAD, Url.CANCEL_PRAISE_HOME, null, jsonObject.toString(), new Callback<SendCodeBean>() {
                                    @Override
                                    public void onSuccess(SendCodeBean sendCodeBean) {
                                        dismissDialog();
                                        praise.setEnabled(true);
                                        if (sendCodeBean.getCode() == Contacts.SUCCESS) {
                                            item.setIsLike(0);
                                            item.setLikeSum(item.getLikeSum() - 1);
                                            quickAdapter.notifyDataSetChanged();
                                            EventBus.getDefault().post("refresh_other_list_cancel_praise:" + item.getId());
                                            EventBus.getDefault().post("refresh_mine");
                                        } else {
                                            if (sendCodeBean.getCode() == Contacts.TOKEN_EMPTY) {
                                            } else {
                                                showImageToas(sendCodeBean.getMsg());
                                            }
                                        }
                                    }

                                    @Override
                                    public void onError(Response<String> response) {
                                        super.onError(response);
                                        dismissDialog();
                                        praise.setEnabled(true);
                                    }
                                });
                            } else {
                                praise.setEnabled(false);
                                showDialog(context, "点赞中...");
                                JSONObject jsonObject = new JSONObject();
                                try {
                                    jsonObject.put("contentId", item.getId());
                                    jsonObject.put("module", 1);
                                } catch (JSONException e) {
                                    e.printStackTrace();
                                }
                                finalOkGo.requestHead(RequestType.POSTJSONHEAD, Url.PRAISE_HOME, null, jsonObject.toString(), new Callback<SendCodeBean>() {
                                    @Override
                                    public void onSuccess(SendCodeBean sendCodeBean) {
                                        dismissDialog();
                                        praise.setEnabled(true);
                                        if (sendCodeBean.getCode() == Contacts.SUCCESS) {
                                            item.setIsLike(1);
                                            item.setLikeSum(item.getLikeSum() + 1);
                                            quickAdapter.notifyDataSetChanged();
                                            EventBus.getDefault().post("refresh_other_list_praise:" + item.getId());
                                            EventBus.getDefault().post("refresh_mine");
                                        } else {
                                            if (sendCodeBean.getCode() == Contacts.TOKEN_EMPTY) {
                                            } else {
                                                showImageToas(sendCodeBean.getMsg());
                                            }
                                        }
                                    }

                                    @Override
                                    public void onError(Response<String> response) {
                                        super.onError(response);
                                        dismissDialog();
                                        praise.setEnabled(true);
                                    }
                                });
                            }
                        }
                    });

                    /**
                     * 关注和点击事件
                     */
                    TextView follow = childView.findViewById(R.id.follow);
                    follow.setVisibility(View.INVISIBLE);

                    /***
                     * 评论列表
                     */
                    XListView comment_listview = childView.findViewById(R.id.comment_listview);
                    TextView comment_count = childView.findViewById(R.id.comment_count);
                    comment_count.setVisibility(View.GONE);
                    comment_listview.setVisibility(View.GONE);
                    /**
                     * 图片展示
                     */
                    MyNineGridView nineGridView = childView.findViewById(R.id.nineGrid);
                    List<String> list = Arrays.asList(item.getUrls().split("\\|"));
                    ArrayList<ImageInfo> imageInfo = new ArrayList<>();
                    for (int i = 0; i < list.size(); i++) {
                        ImageInfo info = new ImageInfo();
//                        info.setThumbnailUrl(list.get(i) + "?roundPic/radius/20");
                        info.setThumbnailUrl(list.get(i) + Config.IMAGE_LIM);
                        info.setBigImageUrl(list.get(i));
                        imageInfo.add(info);
                    }
                    nineGridView.setAdapter(new MyNineGridViewAdapter(context, imageInfo));

                    /**
                     * 投票
                     */
                    XListView vote_num_listview = childView.findViewById(R.id.vote_num_listview);
                    if (item.getIsVote() == 0) {
                        vote_num_listview.setVisibility(View.GONE);
                    } else {
                        vote_num_listview.setVisibility(View.VISIBLE);
                        QuickAdapter<ContentVoteListBean> voteAdapter =
                                new QuickAdapter<ContentVoteListBean>(context, R.layout.item_vote, item.getContentVoteList()) {
                                    @Override
                                    protected void convert(BaseAdapterHelper voteHelper, ContentVoteListBean voteItem) {
                                        TextView vote_tab_yes = voteHelper.getView(R.id.vote_tab_yes);
                                        TextView vote_tab_no = voteHelper.getView(R.id.vote_tab_no);
                                        TextView vote_num = voteHelper.getView(R.id.vote_num);
                                        ProgressBar progressBar = voteHelper.getView(R.id.progressBar);
                                        LinearLayout item_ll = voteHelper.getView(R.id.item_ll);

                                        if ("1".equals(isSelf)) {
                                            vote_tab_yes.setVisibility(View.VISIBLE);
                                            vote_num.setVisibility(View.VISIBLE);
                                            progressBar.setVisibility(View.VISIBLE);
                                            vote_tab_no.setVisibility(View.INVISIBLE);

                                            vote_tab_yes.setText(voteItem.getName());
                                            vote_num.setText(voteItem.getVoteSum() + "票");

                                            progressBar.setMax(item.getVoteTotal());
                                            progressBar.setProgress(voteItem.getVoteSum());
                                        } else {
                                            if (item.getIsVoted() == 1) {
                                                vote_tab_yes.setVisibility(View.VISIBLE);
                                                vote_num.setVisibility(View.VISIBLE);
                                                progressBar.setVisibility(View.VISIBLE);
                                                vote_tab_no.setVisibility(View.INVISIBLE);

                                                vote_tab_yes.setText(voteItem.getName());
                                                vote_num.setText(voteItem.getVoteSum() + "票");

                                                progressBar.setMax(item.getVoteTotal());
                                                progressBar.setProgress(voteItem.getVoteSum());
                                            } else {
                                                vote_tab_yes.setVisibility(View.INVISIBLE);
                                                vote_num.setVisibility(View.INVISIBLE);
                                                progressBar.setVisibility(View.INVISIBLE);
                                                vote_tab_no.setVisibility(View.VISIBLE);

                                                vote_tab_no.setText(voteItem.getName());
                                            }
                                        }

                                        item_ll.setOnClickListener(new View.OnClickListener() {
                                            @Override
                                            public void onClick(View view) {
                                                if (Utils.isDoubleClick()) {
                                                    return;
                                                }
                                                if (item.getIsVoted() == 1) {
                                                    if (voteItem.getIsVote() == 1) {
                                                        item_ll.setEnabled(false);
                                                        showDialog(context, "取消中...");
                                                        JSONObject jsonObject = new JSONObject();
                                                        try {
                                                            jsonObject.put("contentVoteId", voteItem.getId());
                                                            jsonObject.put("contentId", voteItem.getContentId());
                                                        } catch (JSONException e) {
                                                            e.printStackTrace();
                                                        }
                                                        finalOkGo.requestHead(RequestType.POSTJSONHEAD, Url.CANCE_HOME_VOTE, null, jsonObject.toString(), new Callback<SendCodeBean>() {
                                                            @Override
                                                            public void onSuccess(SendCodeBean sendCodeBean) {
                                                                dismissDialog();
                                                                item_ll.setEnabled(true);
                                                                if (sendCodeBean.getCode() == Contacts.SUCCESS) {
                                                                    item.setIsVoted(0);
                                                                    item.setVoteTotal(item.getVoteTotal() - 1);
                                                                    voteItem.setIsVote(0);
                                                                    voteItem.setVoteSum(voteItem.getVoteSum() - 1);
                                                                    notifyDataSetChanged();
                                                                } else {
                                                                    if (sendCodeBean.getCode() == Contacts.TOKEN_EMPTY) {
                                                                    } else {
//                                                                                showImageToas(sendCodeBean.getMsg());
                                                                    }
                                                                }
                                                            }

                                                            @Override
                                                            public void onError(Response<String> response) {
                                                                super.onError(response);
                                                                dismissDialog();
                                                                item_ll.setEnabled(true);
                                                            }
                                                        });
                                                    }
                                                } else {
                                                    if (voteItem.getIsVote() == 0) {
                                                        item_ll.setEnabled(false);
                                                        showDialog(context, "投票中...");
                                                        JSONObject jsonObject = new JSONObject();
                                                        try {
                                                            jsonObject.put("contentId", voteItem.getContentId());
                                                            jsonObject.put("contentVoteId", voteItem.getId());
                                                        } catch (JSONException e) {
                                                            e.printStackTrace();
                                                        }
                                                        finalOkGo.requestHead(RequestType.POSTJSONHEAD, Url.HOME_VOTE, null, jsonObject.toString(), new Callback<SendCodeBean>() {
                                                            @Override
                                                            public void onSuccess(SendCodeBean sendCodeBean) {
                                                                dismissDialog();
                                                                item_ll.setEnabled(true);
                                                                if (sendCodeBean.getCode() == Contacts.SUCCESS) {
                                                                    item.setIsVoted(1);
                                                                    item.setVoteTotal(item.getVoteTotal() + 1);
                                                                    voteItem.setVoteSum(voteItem.getVoteSum() + 1);
                                                                    voteItem.setIsVote(1);
                                                                    notifyDataSetChanged();
                                                                } else {
                                                                    if (sendCodeBean.getCode() == Contacts.TOKEN_EMPTY) {
                                                                    } else {
//                                                                                showImageToas(sendCodeBean.getMsg());
                                                                    }
                                                                }
                                                            }

                                                            @Override
                                                            public void onError(Response<String> response) {
                                                                super.onError(response);
                                                                dismissDialog();
                                                                item_ll.setEnabled(true);
                                                            }
                                                        });
                                                    }
                                                }
                                            }
                                        });


                                    }
                                };
                        vote_num_listview.setAdapter(voteAdapter);
                    }

                } else if (item.getType() == 3) {
                    //推荐置顶

                    /**
                     * 纯文字内容
                     */
                    container.removeAllViews();
                    View childView = LayoutInflater.from(context).inflate(R.layout.item_recommend_img, null, false);
                    container.addView(childView);

                    /**
                     * 点赞和评论数
                     */
                    TextView praise_tv = childView.findViewById(R.id.praise_tv);
                    praise_tv.setText(item.getLikeSum() + "");

                    TextView comment_tv = childView.findViewById(R.id.comment_tv);
                    comment_tv.setText(item.getCommentSum() + "");

                    /**
                     *时间
                     */
                    TextView time = childView.findViewById(R.id.time);
                    timecha(item.getCreateTime(), time);

                    /**
                     * 详情点击事件
                     */
                    LinearLayout item_ll = childView.findViewById(R.id.item_ll);
                    item_ll.setOnClickListener(view16 -> {
                        if (Utils.isDoubleClick()) {
                            return;
                        }
                        Bundle bundle = new Bundle();
                        bundle.putString("flag", "no_img");
                        bundle.putSerializable("data", item);
                        bundle.putInt("position", helper.getAdapterPosition());
                        startActivity(MineInvitationDetailActivity.class, bundle);
                    });
                    item_ll.setTag(helper.getAdapterPosition());

                    childView.findViewById(R.id.more).setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            if (Utils.isDoubleClick()) {
                                return;
                            }
                            DialogUtil.getInstance().showCenterDialog(context, R.layout.dialog_more);
                            LinearLayout dialog_more = (LinearLayout) DialogUtil.getInstance().dialog_center_layout;
                            LinearLayout cancel_follow = dialog_more.findViewById(R.id.cancel_follow);
                            LinearLayout delete = dialog_more.findViewById(R.id.delete);
                            LinearLayout report = dialog_more.findViewById(R.id.report);
                            LinearLayout black_list = dialog_more.findViewById(R.id.black_list);

                            View line = dialog_more.findViewById(R.id.line);
                            View viewline = dialog_more.findViewById(R.id.view);
                            View view1 = dialog_more.findViewById(R.id.view1);

                            if ("1".equals(isSelf)) {
                                report.setVisibility(View.GONE);
                                black_list.setVisibility(View.GONE);
                                cancel_follow.setVisibility(View.GONE);
                                line.setVisibility(View.GONE);
                                viewline.setVisibility(View.GONE);
                                view1.setVisibility(View.INVISIBLE);
                                delete.setVisibility(View.VISIBLE);
                            } else {
                                cancel_follow.setVisibility(View.GONE);
                                line.setVisibility(View.GONE);
                                viewline.setVisibility(View.GONE);
                                view1.setVisibility(View.INVISIBLE);
                                report.setVisibility(View.VISIBLE);
                                black_list.setVisibility(View.GONE);
                                delete.setVisibility(View.GONE);
                            }

                            delete.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View view) {
                                    if (Utils.isDoubleClick()) {
                                        return;
                                    }
                                    DialogUtil.getInstance().dialog_center.dismiss();
                                    showDialog(context, "删除中...");
                                    HttpParams params = new HttpParams();
                                    params.put("contentId", item.getId());
                                    finalOkGo.requestHead(RequestType.POSTHEAD, Url.DELETE_CONTENT, params, Url.DELETE_CONTENT, new Callback<SendCodeBean>() {
                                        @Override
                                        public void onSuccess(SendCodeBean sendCodeBean) {
                                            dismissDialog();
                                            if (sendCodeBean.getCode() == Contacts.SUCCESS) {
                                                quickAdapter.remove(helper.getAdapterPosition());
                                                quickAdapter.notifyDataSetChanged();
                                            } else {
                                                if (sendCodeBean.getCode() == Contacts.TOKEN_EMPTY) {
                                                } else {
                                                    showImageToas(sendCodeBean.getMsg());
                                                }
                                            }
                                        }

                                        @Override
                                        public void onError(Response<String> response) {
                                            super.onError(response);
                                            dismissDialog();
                                        }
                                    });
                                }
                            });

                            report.setOnClickListener(view19 -> {
                                if (Utils.isDoubleClick()) {
                                    return;
                                }
                                DialogUtil.getInstance().dialog_center.dismiss();
                                Bundle bundle = new Bundle();
                                bundle.putString("flag", "report");
                                bundle.putString("contentId", item.getId() + "");
                                bundle.putString("module", "1");
                                bundle.putString("type", "1");
                                bundle.putString("byUserId", item.getUserId() + "");
                                startActivity(ReportActivity.class, bundle);
                            });
                        }
                    });

                    /**
                     * 分享
                     */
                    childView.findViewById(R.id.share).setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
//                            if (item.getStatus() == 0) {
//                                showImageToas("动态正在审核中");
//                                return;
//                            }
                            if (Utils.isDoubleClick()) {
                                return;
                            }
                            contentId = item.getId();
                            showDialog(context, null);
                            JSONObject jsonObject = new JSONObject();
                            try {
                                jsonObject.put("contentId", item.getId());
                                jsonObject.put("module", 1);
                            } catch (JSONException e) {
                                e.printStackTrace();
                            }
                            finalOkGo.requestHead(RequestType.POSTJSONHEAD, Url.SHARE_DATA, null, jsonObject.toString(), new Callback<ShareDataBean>() {
                                @Override
                                public void onSuccess(ShareDataBean shareDataBean) {
                                    dismissDialog();
                                    if (shareDataBean.getCode() == Contacts.SUCCESS) {
                                        showShareDialog(shareDataBean);
                                    } else {
                                        if (shareDataBean.getCode() == Contacts.TOKEN_EMPTY) {
                                        } else {
                                            showImageToas(shareDataBean.getMsg());
                                        }
                                    }

                                }

                                @Override
                                public void onError(Response<String> response) {
                                    super.onError(response);
                                    dismissDialog();
                                }
                            });

                        }
                    });

                    /**
                     *
                     * 跳转他人中心
                     */
                    childView.findViewById(R.id.head_photo_rl).setOnClickListener(view17 -> {
                        if (Utils.isDoubleClick()) {
                            return;
                        }
                        if (item.getAnonymity() == 1) {
                            showImageToas("匿名用户无法查看主页");
                        } else {
                            Bundle bundle = new Bundle();
                            bundle.putString("userId", item.getUserId() + "");
                            bundle.putString("userName", item.getNickname());
                            startActivity(OtherInfoActivity.class, bundle);
                        }
                    });


                    /**
                     * 评论按钮点击事件跳转详情
                     */
                    ImageView comment = childView.findViewById(R.id.comment);
                    comment.setOnClickListener(view1 -> {
                        if (Utils.isDoubleClick()) {
                            return;
                        }
                        Bundle bundle = new Bundle();
                        bundle.putString("flag", "no_img");
                        bundle.putSerializable("data", item);
                        bundle.putInt("position", helper.getAdapterPosition());
                        startActivity(MineInvitationDetailActivity.class, bundle);
                    });

                    /**
                     * 评论框
                     */
                    EditText comment_et = childView.findViewById(R.id.comment_et);
                    childView.findViewById(R.id.send).setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            if (Utils.isDoubleClick()) {
                                return;
                            }
                            if (!TextUtils.isEmpty(comment_et.getText().toString().trim())) {
                                showDialog(context, "评论中...");
                                JSONObject jsonObject = new JSONObject();
                                try {
                                    jsonObject.put("contentId", item.getId());
                                    jsonObject.put("comment", comment_et.getText().toString().trim());
                                    jsonObject.put("position", 1);
                                    jsonObject.put("type", 1);
                                } catch (JSONException e) {
                                    e.printStackTrace();
                                }
                                finalOkGo.requestHead(RequestType.POSTJSONHEAD, Url.COMMENT_SAVE, null, jsonObject.toString(), new Callback<SendCodeBean>() {
                                    @Override
                                    public void onSuccess(SendCodeBean sendCodeBean) {
                                        dismissDialog();
                                        if (sendCodeBean.getCode() == Contacts.SUCCESS) {
                                            if (item.getCommentSum() < 2) {
                                                item.setCommentSum(item.getCommentSum() + 1);
                                                MineAllListBean.PageBean.ListBean.CommentListBean commentListBean = new MineAllListBean.PageBean.ListBean.CommentListBean();
                                                commentListBean.setComment(comment_et.getText().toString().trim());
                                                commentListBean.setNickname(userInfoBean.getUser().getNickname());
                                                item.getCommentList().add(commentListBean);
                                                quickAdapter.notifyDataSetChanged();
                                            } else {
                                                item.setCommentSum(item.getCommentSum() + 1);
                                                MineAllListBean.PageBean.ListBean.CommentListBean commentListBean = new MineAllListBean.PageBean.ListBean.CommentListBean();
                                                commentListBean.setComment(comment_et.getText().toString().trim());
                                                commentListBean.setNickname(userInfoBean.getUser().getNickname());
                                                item.getCommentList().set(0, commentListBean);
                                                quickAdapter.notifyDataSetChanged();
                                            }
                                        } else {
                                            if (sendCodeBean.getCode() == Contacts.TOKEN_EMPTY) {
                                            } else {
                                                showImageToas(sendCodeBean.getMsg());
                                            }
                                        }
                                    }

                                    @Override
                                    public void onError(Response<String> response) {
                                        super.onError(response);
                                        dismissDialog();
                                    }
                                });
                            } else {
//                                showImageToas("请填写点内容吧");
                            }

                        }
                    });

                    /**
                     * 隐藏图片
                     */
                    MyNineGridView nineGridView = childView.findViewById(R.id.nineGrid);
                    nineGridView.setVisibility(View.GONE);

                    /**
                     * 内容
                     */
                    RichTextView content = childView.findViewById(R.id.content);
                    if (!TextUtils.isEmpty(item.getTitle())) {
                        if (!item.getTitle().equals(content.getTag())) {
                            content.setTag(item.getTitle());
                            List<UserModel> list = new ArrayList<>();
                            if (!TextUtils.isEmpty(item.getRemindJson()) && !"[]".equals(item.getRemindJson())) {
                                List<RemindJson> remindJsons = GsonUtil.jsonToList(item.getRemindJson(), RemindJson.class);
                                if (remindJsons != null) {
                                    for (int i = 0; i < remindJsons.size(); i++) {
                                        UserModel userModel = new UserModel();
                                        userModel.setUser_name(remindJsons.get(i).getNickname());
                                        userModel.setUser_id(remindJsons.get(i).getUserId() + "");
                                        list.add(userModel);
                                    }
                                }
                            }


                            content.setVisibility(View.VISIBLE);
//                                content.setText(item.getTitle());

                            //直接使用RichTextView
                            content.setAtColor(Color.parseColor(getString(R.string.remind_color)));
                            content.setLinkColor(Color.BLUE);
                            content.setSpanAtUserCallBackListener(spanAtUserCallBack);
                            //所有配置完成后才设置text
                            content.setRichTextUser(item.getTitle(), list);
                        }
                    } else {
                        content.setVisibility(View.GONE);
                    }

                    /**
                     * 位置
                     */
                    TextView location = childView.findViewById(R.id.location);
                    location.setText(item.getAddress().split("\\|")[0]);
                    location.setTextColor(getResources().getColor(R.color.color_9999));

                    /**
                     * 昵称
                     */
                    TextView name = childView.findViewById(R.id.name);

                    /**
                     * 头像
                     */
                    CircleImageView head_photo = childView.findViewById(R.id.head_photo);
                    if (item.getAnonymity() == 1) {
                        Glide.with(context)
                                .load("")
                                .dontAnimate()
                                .placeholder(R.mipmap.head_anonymous_purple)
                                .into(head_photo);
                        name.setText("匿名用户");
                    } else {
                        Glide.with(context)
                                .load(userInfoBean.getUser().getAvatar() + Config.IMAGE_LIM)
                                .dontAnimate()
                                .error(R.mipmap.icon_no_head)
                                .placeholder(R.mipmap.icon_no_head)
                                .into(head_photo);
                        name.setText(userInfoBean.getUser().getNickname());
                    }

                    /**
                     * 评论列表
                     */
                    XListView comment_listview = childView.findViewById(R.id.comment_listview);
                    TextView comment_count = childView.findViewById(R.id.comment_count);
                    comment_count.setVisibility(View.GONE);
                    comment_listview.setVisibility(View.GONE);

                    /**
                     * 投票
                     */
                    XListView vote_num_listview = childView.findViewById(R.id.vote_num_listview);
                    if (item.getIsVote() == 0) {
                        vote_num_listview.setVisibility(View.GONE);
                    } else {
                        vote_num_listview.setVisibility(View.VISIBLE);
                        QuickAdapter<ContentVoteListBean> voteAdapter =
                                new QuickAdapter<ContentVoteListBean>(context, R.layout.item_vote, item.getContentVoteList()) {
                                    @Override
                                    protected void convert(BaseAdapterHelper voteHelper, ContentVoteListBean voteItem) {
                                        TextView vote_tab_yes = voteHelper.getView(R.id.vote_tab_yes);
                                        TextView vote_tab_no = voteHelper.getView(R.id.vote_tab_no);
                                        TextView vote_num = voteHelper.getView(R.id.vote_num);
                                        ProgressBar progressBar = voteHelper.getView(R.id.progressBar);
                                        LinearLayout item_ll = voteHelper.getView(R.id.item_ll);

                                        if ("1".equals(isSelf)) {
                                            vote_tab_yes.setVisibility(View.VISIBLE);
                                            vote_num.setVisibility(View.VISIBLE);
                                            progressBar.setVisibility(View.VISIBLE);
                                            vote_tab_no.setVisibility(View.INVISIBLE);

                                            vote_tab_yes.setText(voteItem.getName());
                                            vote_num.setText(voteItem.getVoteSum() + "票");

                                            progressBar.setMax(item.getVoteTotal());
                                            progressBar.setProgress(voteItem.getVoteSum());
                                        } else {
                                            if (item.getIsVoted() == 1) {
                                                vote_tab_yes.setVisibility(View.VISIBLE);
                                                vote_num.setVisibility(View.VISIBLE);
                                                progressBar.setVisibility(View.VISIBLE);
                                                vote_tab_no.setVisibility(View.INVISIBLE);

                                                vote_tab_yes.setText(voteItem.getName());
                                                vote_num.setText(voteItem.getVoteSum() + "票");

                                                progressBar.setMax(item.getVoteTotal());
                                                progressBar.setProgress(voteItem.getVoteSum());
                                            } else {
                                                vote_tab_yes.setVisibility(View.INVISIBLE);
                                                vote_num.setVisibility(View.INVISIBLE);
                                                progressBar.setVisibility(View.INVISIBLE);
                                                vote_tab_no.setVisibility(View.VISIBLE);

                                                vote_tab_no.setText(voteItem.getName());
                                            }
                                        }

                                        item_ll.setOnClickListener(new View.OnClickListener() {
                                            @Override
                                            public void onClick(View view) {
                                                if (Utils.isDoubleClick()) {
                                                    return;
                                                }
                                                if (item.getIsVoted() == 1) {
                                                    if (voteItem.getIsVote() == 1) {
                                                        item_ll.setEnabled(false);
                                                        showDialog(context, "取消中...");
                                                        JSONObject jsonObject = new JSONObject();
                                                        try {
                                                            jsonObject.put("contentVoteId", voteItem.getId());
                                                            jsonObject.put("contentId", voteItem.getContentId());
                                                        } catch (JSONException e) {
                                                            e.printStackTrace();
                                                        }
                                                        finalOkGo.requestHead(RequestType.POSTJSONHEAD, Url.CANCE_HOME_VOTE, null, jsonObject.toString(), new Callback<SendCodeBean>() {
                                                            @Override
                                                            public void onSuccess(SendCodeBean sendCodeBean) {
                                                                dismissDialog();
                                                                item_ll.setEnabled(true);
                                                                if (sendCodeBean.getCode() == Contacts.SUCCESS) {
                                                                    item.setIsVoted(0);
                                                                    item.setVoteTotal(item.getVoteTotal() - 1);
                                                                    voteItem.setIsVote(0);
                                                                    voteItem.setVoteSum(voteItem.getVoteSum() - 1);
                                                                    notifyDataSetChanged();
                                                                } else {
                                                                    if (sendCodeBean.getCode() == Contacts.TOKEN_EMPTY) {
                                                                    } else {
//                                                                                showImageToas(sendCodeBean.getMsg());
                                                                    }
                                                                }
                                                            }

                                                            @Override
                                                            public void onError(Response<String> response) {
                                                                super.onError(response);
                                                                dismissDialog();
                                                                item_ll.setEnabled(true);
                                                            }
                                                        });
                                                    }
                                                } else {
                                                    if (voteItem.getIsVote() == 0) {
                                                        item_ll.setEnabled(false);
                                                        showDialog(context, "投票中...");
                                                        JSONObject jsonObject = new JSONObject();
                                                        try {
                                                            jsonObject.put("contentId", voteItem.getContentId());
                                                            jsonObject.put("contentVoteId", voteItem.getId());
                                                        } catch (JSONException e) {
                                                            e.printStackTrace();
                                                        }
                                                        finalOkGo.requestHead(RequestType.POSTJSONHEAD, Url.HOME_VOTE, null, jsonObject.toString(), new Callback<SendCodeBean>() {
                                                            @Override
                                                            public void onSuccess(SendCodeBean sendCodeBean) {
                                                                dismissDialog();
                                                                item_ll.setEnabled(true);
                                                                if (sendCodeBean.getCode() == Contacts.SUCCESS) {
                                                                    item.setIsVoted(1);
                                                                    item.setVoteTotal(item.getVoteTotal() + 1);
                                                                    voteItem.setVoteSum(voteItem.getVoteSum() + 1);
                                                                    voteItem.setIsVote(1);
                                                                    notifyDataSetChanged();
                                                                } else {
                                                                    if (sendCodeBean.getCode() == Contacts.TOKEN_EMPTY) {
                                                                    } else {
//                                                                                showImageToas(sendCodeBean.getMsg());
                                                                    }
                                                                }
                                                            }

                                                            @Override
                                                            public void onError(Response<String> response) {
                                                                super.onError(response);
                                                                dismissDialog();
                                                                item_ll.setEnabled(true);
                                                            }
                                                        });
                                                    }
                                                }
                                            }
                                        });


                                    }
                                };
                        vote_num_listview.setAdapter(voteAdapter);
                    }

                    /**
                     * 点赞接口
                     */
                    ImageView praise = childView.findViewById(R.id.praise);
                    if (item.getIsLike() == 1) {
                        praise.setImageResource(R.mipmap.icon_praise_select);
                    } else {
                        praise.setImageResource(R.mipmap.item_praise);
                    }
                    praise.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            if (Utils.isDoubleClick()) {
                                return;
                            }
                            if (item.getIsLike() == 1) {
                                praise.setEnabled(false);
                                showDialog(context, "取消中...");
                                JSONObject jsonObject = new JSONObject();
                                try {
                                    jsonObject.put("contentId", item.getId());
                                    jsonObject.put("module", 1);
                                } catch (JSONException e) {
                                    e.printStackTrace();
                                }
                                finalOkGo.requestHead(RequestType.POSTJSONHEAD, Url.CANCEL_PRAISE_HOME, null, jsonObject.toString(), new Callback<SendCodeBean>() {
                                    @Override
                                    public void onSuccess(SendCodeBean sendCodeBean) {
                                        dismissDialog();
                                        praise.setEnabled(true);
                                        if (sendCodeBean.getCode() == Contacts.SUCCESS) {
                                            item.setIsLike(0);
                                            item.setLikeSum(item.getLikeSum() - 1);
                                            quickAdapter.notifyDataSetChanged();
                                            EventBus.getDefault().post("refresh_other_list_cancel_praise:" + item.getId());
                                            EventBus.getDefault().post("refresh_mine");
                                        } else {
                                            if (sendCodeBean.getCode() == Contacts.TOKEN_EMPTY) {
                                            } else {
                                                showImageToas(sendCodeBean.getMsg());
                                            }
                                        }
                                    }

                                    @Override
                                    public void onError(Response<String> response) {
                                        super.onError(response);
                                        dismissDialog();
                                        praise.setEnabled(true);
                                    }
                                });
                            } else {
                                praise.setEnabled(false);
                                showDialog(context, "点赞中...");
                                JSONObject jsonObject = new JSONObject();
                                try {
                                    jsonObject.put("contentId", item.getId());
                                    jsonObject.put("module", 1);
                                } catch (JSONException e) {
                                    e.printStackTrace();
                                }
                                finalOkGo.requestHead(RequestType.POSTJSONHEAD, Url.PRAISE_HOME, null, jsonObject.toString(), new Callback<SendCodeBean>() {
                                    @Override
                                    public void onSuccess(SendCodeBean sendCodeBean) {
                                        dismissDialog();
                                        praise.setEnabled(true);
                                        if (sendCodeBean.getCode() == Contacts.SUCCESS) {
                                            item.setIsLike(1);
                                            item.setLikeSum(item.getLikeSum() + 1);
                                            quickAdapter.notifyDataSetChanged();
                                            EventBus.getDefault().post("refresh_other_list_praise:" + item.getId());
                                            EventBus.getDefault().post("refresh_mine");
                                        } else {
                                            if (sendCodeBean.getCode() == Contacts.TOKEN_EMPTY) {
                                            } else {
                                                showImageToas(sendCodeBean.getMsg());
                                            }
                                        }
                                    }

                                    @Override
                                    public void onError(Response<String> response) {
                                        super.onError(response);
                                        dismissDialog();
                                        praise.setEnabled(true);
                                    }
                                });
                            }
                        }
                    });

                    /**
                     * 关注和点击事件
                     */
                    TextView follow = childView.findViewById(R.id.follow);
                    follow.setVisibility(View.INVISIBLE);

                } else {

                }

            }
        };

        LinearLayoutManager layoutManager = new LinearLayoutManager(context);
        layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
        recyclerView.setLayoutManager(layoutManager);
        DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(context, DividerItemDecoration.VERTICAL);
        dividerItemDecoration.setDrawable(getResources().getDrawable(R.drawable.shape_divider_line));
        recyclerView.addItemDecoration(dividerItemDecoration);
        recyclerView.setAdapter(quickAdapter);


        recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {

            private boolean isFlag;

            @Override
            public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
                super.onScrollStateChanged(recyclerView, newState);
                switch (newState) {
                    case AbsListView.OnScrollListener.SCROLL_STATE_IDLE://停止滚动
                        /**在这里执行，视频的自动播放与停止*/
                        isFlag = false;
                        if (PlayerUtils.getNetworkType(context) == PlayerUtils.NETWORK_MOBILE) {
                        } else {
                            autoPlayVideo(recyclerView);
                        }
//                        keepStop(recyclerView);
                    case AbsListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL://拖动
                        isFlag = true;
                        break;
                    case AbsListView.OnScrollListener.SCROLL_STATE_FLING://惯性滑动
                        isFlag = true;
                        break;
                }
            }

            @Override
            public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
                super.onScrolled(recyclerView, dx, dy);
                if (isFlag) {
                    if (PlayerUtils.getNetworkType(context) == PlayerUtils.NETWORK_MOBILE) {
                    } else {
                        autoPlayVideo(recyclerView);
                    }
                } else {
                }
            }


            private void autoPlayVideo(RecyclerView view) {
                //循环遍历可视区域videoview,如果完全可见就开始播放
                for (int i = 0; i < view.getChildCount(); i++) {
                    if (view == null || view.getChildAt(i) == null) continue;

                    FrameLayout frameLayout = view.getChildAt(i).findViewById(R.id.my_container);
                    LinearLayout itemLl = view.getChildAt(i).findViewById(R.id.item_ll);
                    if (frameLayout != null) {
                        Rect rect = new Rect();
                        frameLayout.getLocalVisibleRect(rect);
                        int videoHeight = frameLayout.getHeight();
                        int position = (int) itemLl.getTag();
                        if ((rect.top == 0 && rect.bottom >= videoHeight / 2) || (rect.top <= videoHeight / 2 && rect.bottom == videoHeight)) {
                            if (VideoMineHashMap.getIntance().get(quickAdapter.getItem(position).getId()).isPlaying()) {
                                VideoMineHashMap.getIntance().get(quickAdapter.getItem(position).getId()).setMute(true);
                                VideoMineHashMap.getIntance().get(quickAdapter.getItem(position).getId()).resume();
                            } else {
                                VideoMineHashMap.getIntance().get(quickAdapter.getItem(position).getId()).setMute(true);
                                VideoMineHashMap.getIntance().get(quickAdapter.getItem(position).getId()).start();
                                VideoMineHashMap.getIntance().get(quickAdapter.getItem(position).getId()).setMute(true);
                                VideoMineHashMap.getIntance().get(quickAdapter.getItem(position).getId()).start();
                                VideoMineHashMap.getIntance().get(quickAdapter.getItem(position).getId()).setMute(true);
                                VideoMineHashMap.getIntance().get(quickAdapter.getItem(position).getId()).start();
                            }
                            currentPlayPosition = quickAdapter.getItem(position).getId();
                            return;
                        } else {
                            VideoMineHashMap.getIntance().get(quickAdapter.getItem(position).getId()).pause();
                        }
                    } else {
                        currentPlayPosition = -1;
                    }
                }
            }
        });


        return view;
    }


    @Override
    protected void initData() {
        if (userInfoBean == null) {
            return;
        }
        HttpParams params = new HttpParams();
        params.put("userId", userInfoBean.getUser().getUserId());
        params.put("limit", pageSize);
        params.put("page", pageNum++);
        params.put("isSelf", isSelf);
        finalOkGo.requestHead(RequestType.POSTHEAD, Url.WATCH_CONTENT, params, Url.WATCH_CONTENT, new Callback<MineAllListBean>() {
            @Override
            public void onSuccess(MineAllListBean mineVideoListBean) {
                if (mineVideoListBean.getCode() == Contacts.SUCCESS) {

                    for (int i = 0; i < mineVideoListBean.getPage().getList().size(); i++) {
                        if (mineVideoListBean.getPage().getList().get(i).getType() == 1) {
                            int finalI = i;
                            if (mineVideoListBean.getPage().getList().get(finalI).getWidth() == 0) {
                                Glide.with(context)
                                        .load(mineVideoListBean.getPage().getList().get(i).getUrls() + "?vframe/jpg/offset/1")
                                        .asBitmap()
                                        .into(new SimpleTarget<Bitmap>() {
                                            @Override
                                            public void setRequest(Request request) {
                                                super.setRequest(request);
                                            }

                                            @Override
                                            public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
                                                Logger.e(mineVideoListBean.getPage().getList().get(finalI).getWidth() + "+++" + finalI);
                                                mineVideoListBean.getPage().getList().get(finalI).setWidth(resource.getWidth());
                                                mineVideoListBean.getPage().getList().get(finalI).setHeight(resource.getHeight());

                                            }


                                        });
                            }

                            VideoView videoView = new VideoView(context);
                            videoView.setMute(true);
                            VideoMineHashMap.getIntance().put(mineVideoListBean.getPage().getList().get(i).getId(), videoView);
                            mPreloadManager.addPreloadTask(mineVideoListBean.getPage().getList().get(i).getUrls(), mineVideoListBean.getPage().getList().get(i).getId());
                        }
                    }


                    if (pageNum - 1 == 1) {
                        if (mineVideoListBean.getPage().getList() == null || mineVideoListBean.getPage().getList().size() == 0) {
                            empty_img.setVisibility(View.VISIBLE);
                            if ("1".equals(isSelf)) {
                                empty_img.setImageResource(R.mipmap.icon_mine_empty);
                            } else {
                                if (contentHidden == 1) {
                                    empty_img.setImageResource(R.mipmap.icon_content_hidden);
                                } else {
                                    empty_img.setImageResource(R.mipmap.icon_coment_empty);
                                }
                            }
                        } else {
                            empty_img.setVisibility(View.GONE);
                        }
                        quickAdapter.setNewData(mineVideoListBean.getPage().getList());
                    } else {
                        quickAdapter.addData(mineVideoListBean.getPage().getList());
                    }

                    refreshLayout.finishLoadMore();
                    quickAdapter.notifyDataSetChanged();

                    int pagecount;
                    if (mineVideoListBean.getPage().getTotalCount() % pageSize == 0) {
                        pagecount = mineVideoListBean.getPage().getTotalCount() / pageSize;
                    } else {
                        pagecount = mineVideoListBean.getPage().getTotalCount() / pageSize + 1;
                    }

                    if (pageNum > pagecount) {
                        refreshLayout.setNoMoreData(true);
                        refreshLayout.finishLoadMoreWithNoMoreData();
                    } else {
                        refreshLayout.setNoMoreData(false);
                    }

                } else {
                    if (pageNum - 1 == 1) {
                        empty_img.setVisibility(View.VISIBLE);
                        if ("1".equals(isSelf)) {
                            empty_img.setImageResource(R.mipmap.icon_no_net);
                        } else {
                            if (contentHidden == 1) {
                                empty_img.setImageResource(R.mipmap.icon_content_hidden);
                            } else {
                                empty_img.setImageResource(R.mipmap.icon_mine_empty);
                            }
                        }
                    } else {
                        empty_img.setVisibility(View.GONE);
                    }
                    refreshLayout.finishLoadMore();
                    if (mineVideoListBean.getCode() == Contacts.TOKEN_EMPTY) {
                    } else {
                        showImageToas(mineVideoListBean.getMsg());
                    }
                }
            }

            @Override
            public void onError(Response response) {
                super.onError(response);
                if (empty_img != null) {
                    if (pageNum - 1 == 1) {
                        empty_img.setVisibility(View.VISIBLE);
                        empty_img.setImageResource(R.mipmap.icon_no_net);
                    } else {
                        empty_img.setVisibility(View.GONE);
                    }
                }
                if (refreshLayout != null) {
                    refreshLayout.finishRefresh();
                    refreshLayout.finishLoadMore();
                }
            }
        });
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        EventBus.getDefault().unregister(this);
        mPreloadManager.removeAllPreloadTask();
        unbinder.unbind();
    }

    @Override
    public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
        initData();
    }

    @Override
    public void onRefresh(@NonNull RefreshLayout refreshLayout) {

    }

    @Subscribe(threadMode = ThreadMode.POSTING, sticky = true)
    public void OnMessageEvent(String event) {
        String s = event.split(":")[0];
        if (s.equals("refresh_comment_sum_mine")) {
            quickAdapter.getItem(Integer.parseInt(event.split(":")[1])).setCommentSum(quickAdapter.getItem(Integer.parseInt(event.split(":")[1])).getCommentSum() + 1);
            quickAdapter.notifyDataSetChanged();
        } else if (s.equals("refresh_detail_other_follow")) {
            for (int i = 0; i < quickAdapter.getItemCount(); i++) {
                quickAdapter.getItem(i).setIsAttention(1);
            }
            quickAdapter.notifyDataSetChanged();
        } else if (event.equals("refresh_detail_other_cancel_follow")) {
            for (int i = 0; i < quickAdapter.getItemCount(); i++) {
                quickAdapter.getItem(i).setIsAttention(0);
            }
            quickAdapter.notifyDataSetChanged();
        } else if (s.equals("refresh_mine_cancel_praise")) {
            quickAdapter.getItem(Integer.parseInt(event.split(":")[2])).setLikeSum(quickAdapter.getItem(Integer.parseInt(event.split(":")[2])).getLikeSum() - 1);
            quickAdapter.getItem(Integer.parseInt(event.split(":")[2])).setIsLike(0);
            quickAdapter.notifyDataSetChanged();
        } else if (s.equals("refresh_mine_praise")) {
            quickAdapter.getItem(Integer.parseInt(event.split(":")[2])).setLikeSum(quickAdapter.getItem(Integer.parseInt(event.split(":")[2])).getLikeSum() + 1);
            quickAdapter.getItem(Integer.parseInt(event.split(":")[2])).setIsLike(1);
            quickAdapter.notifyDataSetChanged();
        } else if (s.equals("refresh_mine_tab_data")) {
            pageNum = 1;
            initData();
        } else if (s.equals("mine_position==-1")) {
            currentPlayPosition = -1;
        } else if (s.equals("refresh_mimeAll_list")) {
            userInfoBean = (UserInfoBean) SharedPreferencesHelp.getBean("userInfo");
            pageNum = 1;
            initData();
        } else if (s.equals("scollTo_mine_top")) {
            if ("0".equals(event.split(":")[1])) {
//                recyclerView.smoothScrollToPosition(0);
                recyclerView.scrollToPosition(0);
            }
        } else if (s.equals("refresh_mine_data")) {
            if ("0".equals(event.split(":")[1])) {
//                recyclerView.smoothScrollToPosition(0);
                pageNum = 1;
                initData();
            }
        } else if (s.equals("refresh_mine_cancel_vote")) {
            quickAdapter.getItem(Integer.parseInt(event.split(":")[2])).setVoteTotal(quickAdapter.getItem(Integer.parseInt(event.split(":")[2])).getVoteTotal() - 1);
            quickAdapter.getItem(Integer.parseInt(event.split(":")[2])).setIsVoted(0);
            quickAdapter.getItem(Integer.parseInt(event.split(":")[2])).getContentVoteList().get(Integer.parseInt(event.split(":")[3])).setVoteSum(quickAdapter.getItem(Integer.parseInt(event.split(":")[2])).getContentVoteList().get(Integer.parseInt(event.split(":")[3])).getVoteSum() - 1);
            quickAdapter.getItem(Integer.parseInt(event.split(":")[2])).getContentVoteList().get(Integer.parseInt(event.split(":")[3])).setIsVote(0);
            quickAdapter.notifyDataSetChanged();
        } else if (s.equals("refresh_mine_vote")) {
            quickAdapter.getItem(Integer.parseInt(event.split(":")[2])).setVoteTotal(quickAdapter.getItem(Integer.parseInt(event.split(":")[2])).getVoteTotal() + 1);
            quickAdapter.getItem(Integer.parseInt(event.split(":")[2])).setIsVoted(1);
            quickAdapter.getItem(Integer.parseInt(event.split(":")[2])).getContentVoteList().get(Integer.parseInt(event.split(":")[3])).setVoteSum(quickAdapter.getItem(Integer.parseInt(event.split(":")[2])).getContentVoteList().get(Integer.parseInt(event.split(":")[3])).getVoteSum() + 1);
            quickAdapter.getItem(Integer.parseInt(event.split(":")[2])).getContentVoteList().get(Integer.parseInt(event.split(":")[3])).setIsVote(1);
            quickAdapter.notifyDataSetChanged();
        }
    }

    private void showShareDialog(ShareDataBean shareDataBean) {

        DialogUtil.getInstance().showBottomDialog(context, R.layout.dialog_share);
        LinearLayout dialog_share = (LinearLayout) DialogUtil.getInstance().dialog_bottom_layout;
        dialog_share.findViewById(R.id.close).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (Utils.isDoubleClick()) {
                    return;
                }
                DialogUtil.getInstance().dialog_bottom.dismiss();
            }
        });

        dialog_share.findViewById(R.id.share_wechat).setOnClickListener(view -> {
            if (Utils.isDoubleClick()) {
                return;
            }
            DialogUtil.getInstance().dialog_bottom.dismiss();
            WXShareUtil wxShareUtil = new WXShareUtil(context);
            wxShareUtil.registerWx();
            WechatLoginUtil.getInstance().setWechatCallBack(MineAllFragment.this);
            String url = "";
            if (shareDataBean.getContent().getType() == 1) {
                url = shareDataBean.getContent().getUrls() + "?vframe/jpg/offset/1";
            } else if (shareDataBean.getContent().getType() == 2) {
                url = shareDataBean.getContent().getUrls().split("\\|")[0] + "?imageView2/2/w/100";
            } else if (shareDataBean.getContent().getType() == 3) {
                url = "";
            }
            wxShareUtil.share(shareDataBean.getUrl(),
                    shareDataBean.getContent().getTitle(),
                    "",
                    url, wxShareUtil.SHARETOFRIEND);
        });

        dialog_share.findViewById(R.id.share_wechat_friend).setOnClickListener(view -> {
            if (Utils.isDoubleClick()) {
                return;
            }
            DialogUtil.getInstance().dialog_bottom.dismiss();
            WXShareUtil wxShareUtil = new WXShareUtil(context);
            wxShareUtil.registerWx();
            WechatLoginUtil.getInstance().setWechatCallBack(MineAllFragment.this);
            String url = "";
            if (shareDataBean.getContent().getType() == 1) {
                url = shareDataBean.getContent().getUrls() + "?vframe/jpg/offset/1";
            } else if (shareDataBean.getContent().getType() == 2) {
                url = shareDataBean.getContent().getUrls().split("\\|")[0] + "?imageView2/2/w/100";
            } else if (shareDataBean.getContent().getType() == 3) {
                url = "";
            }
            wxShareUtil.share(shareDataBean.getUrl(),
                    shareDataBean.getContent().getTitle(),
                    "",
                    url, wxShareUtil.SHARETOPYQ);
        });

        dialog_share.findViewById(R.id.share_qq).setOnClickListener(view -> {
            if (Utils.isDoubleClick()) {
                return;
            }
            DialogUtil.getInstance().dialog_bottom.dismiss();
            mTencent = Tencent.createInstance(Config.QQ_APP_ID, ContextUtil.getContext());
            Bundle params = new Bundle();
            params.putInt(QQShare.SHARE_TO_QQ_KEY_TYPE, QQShare.SHARE_TO_QQ_TYPE_DEFAULT);
            params.putString(QQShare.SHARE_TO_QQ_TITLE, shareDataBean.getContent().getTitle());
            params.putString(QQShare.SHARE_TO_QQ_SUMMARY, "");
            params.putString(QQShare.SHARE_TO_QQ_TARGET_URL, shareDataBean.getUrl());
            mTencent.shareToQQ(context, params, new BaseUiListener());
        });

        dialog_share.findViewById(R.id.share_qq_space).setOnClickListener(view -> {
            if (Utils.isDoubleClick()) {
                return;
            }
            DialogUtil.getInstance().dialog_bottom.dismiss();
            mTencent = Tencent.createInstance(Config.QQ_APP_ID, context);
            Bundle params = new Bundle();
            params.putInt(QzonePublish.PUBLISH_TO_QZONE_KEY_TYPE, QzonePublish.PUBLISH_TO_QZONE_TYPE_PUBLISHMOOD);
            params.putString(QzonePublish.PUBLISH_TO_QZONE_SUMMARY, shareDataBean.getContent().getTitle() + "\n" + shareDataBean.getUrl());//选填
            mTencent.publishToQzone(context, params, new BaseUiListener());
        });

        dialog_share.findViewById(R.id.share_weibo).setOnClickListener(view -> {
            if (Utils.isDoubleClick()) {
                return;
            }
            DialogUtil.getInstance().dialog_bottom.dismiss();
            WbSdk.install(ContextUtil.getContext(), new AuthInfo(ContextUtil.getContext(), Config.SINA_APP_KEY, Config.REDIRECT_URL, ""));
            WbShareHandler shareHandler = new WbShareHandler(context);
            shareHandler.registerApp();
            WeiboMultiMessage weiboMessage = new WeiboMultiMessage();
            weiboMessage.textObject = getTextObj(shareDataBean.getUrl(), shareDataBean.getContent().getTitle());
            shareHandler.shareMessage(weiboMessage, false);
        });

        dialog_share.findViewById(R.id.copy_link).setOnClickListener(view -> {
            if (Utils.isDoubleClick()) {
                return;
            }
            DialogUtil.getInstance().dialog_bottom.dismiss();
            ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
            // 创建一个剪贴数据集，包含一个普通文本数据条目（需要复制的数据）
            ClipData clipData = ClipData.newPlainText(null, shareDataBean.getUrl());
            // 把数据集设置（复制）到剪贴板
            clipboard.setPrimaryClip(clipData);
            showToast("链接已复制");
        });

        dialog_share.findViewById(R.id.copy_text).setOnClickListener(view -> {
            if (Utils.isDoubleClick()) {
                return;
            }
            DialogUtil.getInstance().dialog_bottom.dismiss();
            ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
            // 创建一个剪贴数据集，包含一个普通文本数据条目（需要复制的数据）
            ClipData clipData = ClipData.newPlainText(null, shareDataBean.getContent().getTitle());
            // 把数据集设置（复制）到剪贴板
            clipboard.setPrimaryClip(clipData);
            showToast("文字已复制");
        });

        dialog_share.findViewById(R.id.black_list).setVisibility(View.INVISIBLE);

        dialog_share.findViewById(R.id.report).setVisibility(View.INVISIBLE);
    }

    @Override
    public void onWbShareSuccess() {
        showToast("分享成功");
        JSONObject jsonObject = new JSONObject();
        try {
            jsonObject.put("contentId", contentId);
            jsonObject.put("module", 1);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        finalOkGo.requestHead(RequestType.POSTJSONHEAD, Url.SHARE_SUCCESS, null, jsonObject.toString(), new Callback<SendCodeBean>() {
            @Override
            public void onSuccess(SendCodeBean sendCodeBean) {
                if (sendCodeBean.getCode() == Contacts.SUCCESS) {

                } else {
                    if (sendCodeBean.getCode() == Contacts.TOKEN_EMPTY) {
                    } else {
                        showImageToas(sendCodeBean.getMsg());
                    }
                }
            }
        });
    }

    @Override
    public void onWbShareCancel() {
        showImageToas("分享取消");
    }

    @Override
    public void onWbShareFail() {
        showImageToas("分享失败");
    }

    @Override
    public void callBack(BaseResp baseResp) {
        switch (baseResp.errCode) {
            case BaseResp.ErrCode.ERR_OK:
                showToast("分享成功");
                JSONObject jsonObject = new JSONObject();
                try {
                    jsonObject.put("contentId", contentId);
                    jsonObject.put("module", 1);
                } catch (JSONException e) {
                    e.printStackTrace();
                }
                finalOkGo.requestHead(RequestType.POSTJSONHEAD, Url.SHARE_SUCCESS, null, jsonObject.toString(), new Callback<SendCodeBean>() {
                    @Override
                    public void onSuccess(SendCodeBean sendCodeBean) {
                        if (sendCodeBean.getCode() == Contacts.SUCCESS) {

                        } else {
                            showImageToas(sendCodeBean.getMsg());
                        }
                    }
                });
                break;
            case BaseResp.ErrCode.ERR_USER_CANCEL:
                showImageToas("分享取消");
                break;
            case BaseResp.ErrCode.ERR_AUTH_DENIED:
                showImageToas("分享被拒绝");
                break;
            default:
                showImageToas("分享返回");
                break;
        }
    }

    private class BaseUiListener implements IUiListener {

        @Override
        public void onComplete(Object o) {
            showToast("分享成功");
            JSONObject jsonObject = new JSONObject();
            try {
                jsonObject.put("contentId", contentId);
                jsonObject.put("module", 1);
            } catch (JSONException e) {
                e.printStackTrace();
            }
            finalOkGo.requestHead(RequestType.POSTJSONHEAD, Url.SHARE_SUCCESS, null, jsonObject.toString(), new Callback<SendCodeBean>() {
                @Override
                public void onSuccess(SendCodeBean sendCodeBean) {
                    if (sendCodeBean.getCode() == Contacts.SUCCESS) {

                    } else {
                        if (sendCodeBean.getCode() == Contacts.TOKEN_EMPTY) {
                        } else {
                            showImageToas(sendCodeBean.getMsg());
                        }
                    }
                }
            });
        }

        @Override
        public void onError(UiError uiError) {
            showImageToas("分享失败");
        }

        @Override
        public void onCancel() {
            showImageToas("分享取消");
        }
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (mTencent != null) {
            mTencent.onActivityResult(requestCode, resultCode, data);
        }
    }


    private TextObject getTextObj(String url, String title) {
        TextObject textObject = new TextObject();
        textObject.text = title + "\n" + url;
        textObject.title = title;
        textObject.actionUrl = url;
        return textObject;
    }

}
